1
0
Fork 0
chezmoi/dot_config/nvim/lua/configs/packages/nvim-cmp.lua

47 lines
1 KiB
Lua

local M = {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-vsnip',
'onsails/lspkind.nvim',
},
}
function M.config()
local cmp = require 'cmp'
cmp.setup({
-- documentation = true,
sources = {
{ name = 'nvim_lsp' },
{ name = 'nvim_lua' },
{ name = 'buffer' },
{ name = 'path' },
{ name = 'vsnip' },
-- { name = 'nvim_lsp_signature_help' },
},
formatting = {
format = require('lspkind').cmp_format({
-- mode = 'symbol',
}),
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({ select = false })
}),
snippet = {
expand = function(args)
-- For `vsnip` user.
vim.fn['vsnip#anonymous'](args.body) -- For `vsnip` user.
end
}
})
end
return M