Add nvim_cmp

This commit is contained in:
sfigato 2023-04-16 11:46:29 -03:00
parent b342c1154a
commit 87225d7257
Signed by: blallo
GPG Key ID: C530464EEDCF489A
2 changed files with 37 additions and 0 deletions

32
lua/config/nvim_cmp.lua Normal file
View File

@ -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({
['<C-Down>'] = cmp.mapping.scroll_docs(-4),
['<C-Up>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = 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

View File

@ -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'