From a41a51db0fe0ef805bfd43af793f70c5350dbd91 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 3 Feb 2022 14:39:59 +0100 Subject: nvim: adjust to new LSP commands --- neovim/.config/nvim/init.vim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/neovim/.config/nvim/init.vim b/neovim/.config/nvim/init.vim index e5b2933..45e1ece 100644 --- a/neovim/.config/nvim/init.vim +++ b/neovim/.config/nvim/init.vim @@ -189,6 +189,12 @@ cmp.setup({ -- Setup the actual language servers local nvim_lsp = require('lspconfig') +local opts = { noremap=true, silent=true } +vim.api.nvim_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) +vim.api.nvim_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) +vim.api.nvim_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) +vim.api.nvim_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) + -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) @@ -199,8 +205,6 @@ local on_attach = function(client, bufnr) buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. - local opts = { noremap=true, silent=true } - -- See `:help vim.lsp.*` for documentation on any of the below functions buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) @@ -214,10 +218,6 @@ local on_attach = function(client, bufnr) buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) lsp_status.on_attach(client) @@ -235,7 +235,7 @@ for _, lsp in ipairs(servers) do capabilities = require('cmp_nvim_lsp').update_capabilities(lsp_status.capabilities) } if lsp == 'pylsp' then - config['cmd'] = { 'pyls' } + config['settings'] = {pylsp = {plugins = {pylint = {enabled = true}}}} end if lsp == 'rust_analyzer' then require('rust-tools').setup({server = config}) -- cgit v1.2.3