mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-04 04:35:29 +00:00
chore(vim): add completion plugins and configuration
This commit is contained in:
51
nvim/plugins/cmp.lua
Normal file
51
nvim/plugins/cmp.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
-- nvim-cmp
|
||||
-- https://github.com/hrsh7th/nvim-cmp
|
||||
|
||||
local status, cmp = pcall(require, 'cmp')
|
||||
if (not status) then return end
|
||||
|
||||
cmp.setup({
|
||||
auto_select = false,
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end
|
||||
},
|
||||
mapping = {
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-x>'] = cmp.mapping.complete(),
|
||||
['<C-y>'] = cmp.config.disable,
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping({
|
||||
i = cmp.mapping.confirm({ select = true }),
|
||||
c = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'path' },
|
||||
{ name = 'ultisnips' },
|
||||
{ name = 'buffer', keyword_length = 5 },
|
||||
{ name = 'npm', keyword_length = 4 },
|
||||
},
|
||||
formatting = {
|
||||
format = require('lspkind').cmp_format {
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[buf]",
|
||||
nvim_lsp = "[LSP]",
|
||||
path = "[path]",
|
||||
luasnip = "[snip]"
|
||||
}
|
||||
}
|
||||
},
|
||||
experimental = {
|
||||
native_menu = false,
|
||||
ghost_text = true
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user