diff --git a/lua/keymap.lua b/lua/keymap.lua index 29f0c33..fa3dbbe 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -44,3 +44,8 @@ vim.keymap.set("n", "", "zc", {}) vim.keymap.set("n", "", "zo", {}) -- clangd switch source/header vim.keymap.set({ "i", "n" }, "", vim.cmd.ClangdSwitchSourceHeader, { silent = true }) +-- goto mappings +vim.keymap.set({"i", "n"}, "gd", vim.lsp.buf.definition, {}) +vim.keymap.set({"i", "n"}, "gD", vim.lsp.buf.declaration, {}) +vim.keymap.set({"i", "n"}, "gi", vim.lsp.buf.implementation, {}) +vim.keymap.set({"i", "n"}, "", vim.lsp.buf.code_action, {}) diff --git a/lua/plugins.lua b/lua/plugins.lua index 45fe6fe..4c44c79 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -2,18 +2,19 @@ local plugins = { { "williamboman/mason.nvim", }, - { - "ray-x/lsp_signature.nvim" - }, + { + "ray-x/lsp_signature.nvim", + }, { "williamboman/mason-lspconfig.nvim", }, { "neovim/nvim-lspconfig", }, - { - "p00f/clangd_extensions.nvim", - }, + { "folke/neodev.nvim", opts = {} }, + { + "p00f/clangd_extensions.nvim", + }, { "folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, diff --git a/lua/setuplsp.lua b/lua/setuplsp.lua index ace8a5a..f7b149c 100644 --- a/lua/setuplsp.lua +++ b/lua/setuplsp.lua @@ -1,4 +1,7 @@ -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md +require("neodev").setup({ + -- add any options here, or leave empty to use the default settings +}) local capabilities = require("cmp_nvim_lsp").default_capabilities() capabilities.textDocument.foldingRange = { @@ -18,10 +21,10 @@ require("lspconfig").yamlls.setup({ }) require("lspconfig").clangd.setup({ capabilities = capabilities, - cmd = { - "clangd", - "--header-insertion=iwyu" - } + cmd = { + "clangd", + "--header-insertion=iwyu", + }, }) require("lspconfig").pyright.setup({ capabilities = capabilities, @@ -55,17 +58,18 @@ require("lspconfig").lua_ls.setup({ -- Make the server aware of Neovim runtime files workspace = { checkThirdParty = false, - library = { - vim.env.VIMRUNTIME, - -- Depending on the usage, you might want to add additional paths here. - -- "${3rd}/luv/library" - -- "${3rd}/busted/library", - }, -- or pull in all of 'runtimepath'. NOTE: this is a lot slower - -- library = vim.api.nvim_get_runtime_file("", true) + library = vim.api.nvim_get_runtime_file("", true) }, }) end, + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + }, + }, }) local luasnip = require("luasnip")