From 87225d72572bf189376eadb91ee46bdc076386c2 Mon Sep 17 00:00:00 2001 From: Blallo Date: Sun, 16 Apr 2023 11:46:29 -0300 Subject: [PATCH] Add nvim_cmp --- lua/config/nvim_cmp.lua | 32 ++++++++++++++++++++++++++++++++ lua/plugins.lua | 5 +++++ 2 files changed, 37 insertions(+) create mode 100644 lua/config/nvim_cmp.lua diff --git a/lua/config/nvim_cmp.lua b/lua/config/nvim_cmp.lua new file mode 100644 index 0000000..0cde8fc --- /dev/null +++ b/lua/config/nvim_cmp.lua @@ -0,0 +1,32 @@ +local cmp = require('cmp') + +cmp.setup({ + snippet = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + }, { + { name = 'buffer' }, + }) +}) + +local servers = require('lspconfig') +local capabilities = require('cmp_nvim_lsp').default_capabilities() +for _, server in ipairs(servers) do + require('lspconfig')[server].setup { + capabilities = capabilities + } +end diff --git a/lua/plugins.lua b/lua/plugins.lua index f336ff4..aab037f 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -75,6 +75,11 @@ local function init() use {'ms-jpq/coq_nvim', branch = 'coq'} use {'ms-jpq/coq.artifacts', branch = 'artifacts'} use {'ms-jpq/coq.thirdparty', branch = '3p'} + -- -- nvim-cmp + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/nvim-cmp' + use 'hrsh7th/cmp-vsnip' + use 'hrsh7th/vim-vsnip' -- Split maximizer use 'szw/vim-maximizer'