From 9bbe0077104e5e0dab8b1a8f197f7ce9bb240be4 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 7 Nov 2023 13:39:23 +0100 Subject: nvim: Make LSP config more minimal --- .config/nvim/after/plugin/nvim-cmp.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .config/nvim/after/plugin/nvim-cmp.lua (limited to '.config/nvim/after/plugin/nvim-cmp.lua') diff --git a/.config/nvim/after/plugin/nvim-cmp.lua b/.config/nvim/after/plugin/nvim-cmp.lua new file mode 100644 index 0000000..4bc95c5 --- /dev/null +++ b/.config/nvim/after/plugin/nvim-cmp.lua @@ -0,0 +1,31 @@ +local conf = require('lspconfig') +local capabilities = require('cmp_nvim_lsp').default_capabilities() +conf['clangd'].setup { capabilities = capabilities } +conf['gopls'].setup { capabilities = capabilities } +conf['lua_ls'].setup { capabilities = capabilities } +conf['rust_analyzer'].setup { capabilities = capabilities } + +local cmp = require('cmp') +cmp.setup { + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'path' }, + { name = 'luasnip' }, + }, { + { name = 'buffer', length = 5 }, + }), + experimental = { + ghost_text = true, + } +} -- cgit v1.2.3