summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-01-09 13:12:48 +0100
committerDaniel Weipert <code@drogueronin.de>2023-10-30 09:52:23 +0100
commiteb855e3c8b96358520ac2a593afa80997ae23335 (patch)
treedcd2c0feb0a318e1f4d760433c588f437040f611 /.config
parente761dec360665141feb8a60fa6165a48513c3d2a (diff)
[nvim] use mason for lsp installs and adjust config
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/init.vim30
1 files changed, 17 insertions, 13 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index 9a496bd..43fb173 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -28,8 +28,9 @@ Plug 'gpanders/editorconfig.nvim'
Plug 'iamcco/markdown-preview.nvim', {'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
" if install fails do `:call mkdp#util#install() manually`
+Plug 'williamboman/mason.nvim'
+Plug 'williamboman/mason-lspconfig.nvim'
Plug 'neovim/nvim-lspconfig'
-Plug 'williamboman/nvim-lsp-installer'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'saadparwaiz1/cmp_luasnip'
@@ -173,11 +174,11 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
- buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
- buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
+ buf_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
+ buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
+ buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
+ buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
+ buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.format({async = true})<CR>', opts)
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
@@ -185,13 +186,16 @@ capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
vim.o.completeopt = 'menuone,noselect'
-local lsp_installer = require('nvim-lsp-installer')
-lsp_installer.on_server_ready(function(server)
- server:setup({
- on_attach = on_attach,
- capabilities = capabilities,
- })
-end)
+require('mason').setup()
+require('mason-lspconfig').setup()
+require('mason-lspconfig').setup_handlers {
+ function (server_name)
+ require ('lspconfig')[server_name].setup {
+ on_attach = on_attach,
+ capabilities = capabilities,
+ }
+ end
+}
local cmp = require('cmp')
local luasnip = require('luasnip')