From 3ed67b0aaca5911bc4485e9fc1d447b4e0dc9042 Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 27 Oct 2021 09:35:24 +0200 Subject: [PATCH] nvimrc: improve nvim-cmp configuration --- nvimrc | 65 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/nvimrc b/nvimrc index fc9d095..6cf7756 100644 --- a/nvimrc +++ b/nvimrc @@ -596,6 +596,41 @@ require 'nvim-treesitter.configs'.setup { } EOF +" nvim-cmp: + +packadd! nvim-cmp " https://github.com/hrsh7th/nvim-cmp.git +packadd! vim-vsnip " https://github.com/hrsh7th/vim-vsnip.git +packadd! cmp-vsnip " https://github.com/hrsh7th/cmp-vsnip.git +packadd! cmp-nvim-lsp " https://github.com/hrsh7th/cmp-nvim-lsp.git +packadd! cmp-buffer " https://github.com/hrsh7th/cmp-buffer.git +packadd! cmp-path " https://github.com/hrsh7th/cmp-path.git +packadd! cmp-calc " https://github.com/hrsh7th/cmp-calc + +lua <'] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ select = true, behaviour = cmp.ConfirmBehavior.Replace }), + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'buffer' }, + { name = 'path' }, + { name = 'calc' }, + }) + }) +EOF + " LSP packadd! nvim-lspconfig " https://github.com/neovim/nvim-lspconfig.git @@ -654,6 +689,8 @@ capabilities.textDocument.completion.completionItem.resolveSupport = { } } +require('cmp_nvim_lsp').update_capabilities(capabilities) + nvim_lsp.gopls.setup{ settings = { gopls = { @@ -767,31 +804,3 @@ nvim_lsp.sumneko_lua.setup { on_attach = on_attach, } EOF - -" nvim-cmp: - -packadd! nvim-cmp " https://github.com/hrsh7th/nvim-cmp.git -packadd! cmp-nvim-lsp " https://github.com/hrsh7th/cmp-nvim-lsp.git -packadd! cmp-buffer " https://github.com/hrsh7th/cmp-buffer.git -packadd! cmp-path " https://github.com/hrsh7th/cmp-path.git -packadd! cmp-calc " https://github.com/hrsh7th/cmp-calc - -lua <'] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ select = true }), - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'buffer' }, - { name = 'path' }, - { name = 'calc' }, - }) - }) -EOF