diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 2539dac..4678900 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,6 +1,8 @@ { "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "github-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, @@ -9,5 +11,6 @@ "nvim-lspconfig": { "branch": "master", "commit": "fd26f8626c03b424f7140d454031d1dcb8d23513" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" }, - "telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" } + "telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/nvim/lua/lsp-config.lua b/nvim/lua/lsp-config.lua index ff658e0..748e5ae 100644 --- a/nvim/lua/lsp-config.lua +++ b/nvim/lua/lsp-config.lua @@ -13,10 +13,10 @@ require("mason-lspconfig").setup({ -- See `:help vim.diagnostic.*` for documentation on any of the below functions -- local opts = { noremap = true, silent = true } -vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) +vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) +vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) local on_attach = function(client, bufnr) -- Enable completion triggered by @@ -33,17 +33,17 @@ local on_attach = function(client, bufnr) vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) vim.keymap.set("n", "", vim.lsp.buf.signature_help, bufopts) - vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set("n", "wl", function() + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set("n", "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) - vim.keymap.set("n", "lf", function() + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) + vim.keymap.set("n", "lf", function() vim.lsp.buf.format({ async = true, }) @@ -102,12 +102,27 @@ require("lspconfig").lua_ls.setup({ capabilities = capabilities, handlers = handlers }) -require("lspconfig").gopls.setup {capabilities = capabilities, handlers = handlers} -require("lspconfig").bashls.setup {capabilities = capabilities, handlers = handlers, +require("lspconfig").gopls.setup { capabilities = capabilities, handlers = handlers, on_attach = on_attach} +require("lspconfig").bashls.setup { capabilities = capabilities, handlers = handlers, + on_attach = on_attach, settings = { bashIde = { globPattern = "*@(.sh|.inc|.bash|.command)" } } } -require'lspconfig'.pyright.setup{} +require("lspconfig").pyright.setup { capabilities = capabilities, handlers = handlers, + on_attach = on_attach, + settings = { + python = { + analysis = { + include = { + '~/arcadia', + '~/arcadia/yt/python', + '~/arcadia/contrib/libs/protobuf/python', + '~/arcadia/contrib/python', + } + } + } + } +} diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index 76a4b7a..cde932d 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -38,13 +38,33 @@ local plugins = { "nvim-telescope/telescope-file-browser.nvim", dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" } }, - 'hrsh7th/nvim-cmp', -- Auto-completion plugin - dependencies = { - 'hrsh7th/cmp-nvim-lsp', -- LSP source for nvim-cmp - 'hrsh7th/cmp-buffer', -- Buffer source for nvim-cmp - 'hrsh7th/cmp-path', -- Path source for nvim-cmp + { + 'hrsh7th/nvim-cmp', -- Auto-completion plugin + dependencies = { + 'hrsh7th/cmp-nvim-lsp', -- LSP source for nvim-cmp + 'hrsh7th/cmp-buffer', -- Buffer source for nvim-cmp + 'hrsh7th/cmp-path', -- Path source for nvim-cmp + 'L3MON4D3/LuaSnip', + }, }, - 'L3MON4D3/LuaSnip', + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, + } } require("lazy").setup(plugins)