cpp vim and minor fixes

This commit is contained in:
2024-03-13 12:04:59 +01:00
parent 9282d46fcd
commit e9abe12291
7 changed files with 106 additions and 7 deletions

View File

@@ -14,7 +14,15 @@ for _, lsp in ipairs(servers) do
}
end
lspconfig.svelte.setup{}
lspconfig.svelte.setup {}
lspconfig.clangd.setup {
on_attach = function (client, bufnr)
client.server_capabilities.signatureHelpProvider = false
on_attach(client, bufnr)
end,
capabilities = capabilities,
}
lspconfig.rust_analyzer.setup({
on_attach = on_attach,

View File

@@ -0,0 +1,25 @@
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local null_ls = require("null-ls")
local opts = {
sources = {
null_ls.builtins.formatting.clang_format,
},
on_attach = function (client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,
}
return opts

View File

@@ -19,6 +19,20 @@ M.general = {
},
}
M.dap = {
plugin = true,
n = {
["<leader>db"] = {
"<cmd> DapToggleBreakpoint <CR>",
"Add breakpoint at line",
},
["<leader>dr"] = {
"<cmd> DapContinue <CR>",
"Start or continue the debugger",
}
}
}
-- more keybinds!
return M

View File

@@ -16,6 +16,9 @@ local plugins = {
opts = {
ensure_installed = {
"rust-analyzer",
"clangd",
"clang-format",
"codelldb",
}
},
},
@@ -30,6 +33,53 @@ local plugins = {
opts = overrides.nvimtree,
},
{
"jose-elias-alvarez/null-ls.nvim",
event = "VeryLazy",
opts = function()
return require "custom.configs.null-ls"
end,
},
{
"rcarriga/nvim-dap-ui",
event = "VeryLazy",
dependencies = "mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
local dapui = require("dapui")
dapui.setup()
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.after.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.after.event_exited["dapui_config"] = function()
dapui.close()
end
end
},
{
"jay-babu/mason-nvim-dap.nvim",
event = "VeryLazy",
dependencies = {
"williamboman/mason.nvim",
"mfussenegger/nvim-dap",
},
opts = {
handlers = {}
},
},
{
"mfussenegger/nvim-dap",
config = function(_, _)
require("core.utils").load_mappings("dap")
end
},
{
"rust-lang/rust.vim",
ft = "rust",