mirror of
https://github.com/d0zingcat/dotfiles.git
synced 2026-05-16 23:16:47 +00:00
mig packer to lazy and archive
Signed-off-by: d0zingcat <leewtang@gmail.com>
This commit is contained in:
45
nvim/lua/legacy/nvim_cmp.lua
Normal file
45
nvim/lua/legacy/nvim_cmp.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
local fn = vim.fn
|
||||
|
||||
-- nvim-cmp
|
||||
local cmp = require('cmp')
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
fn['vsnip#anonymous'](args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
-- set a name for each source
|
||||
vim_item.menu = ({
|
||||
buffer = '[Buf]',
|
||||
nvim_lsp = '[LSP]',
|
||||
luasnip = '[Snip]',
|
||||
nvim_lua = '[Lua]',
|
||||
latex_symbols = '[Latex]',
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
-- ['<C-e>'] = cmp.mapping.complete(),
|
||||
--["<C-e>"] = cmp.mapping.close(),
|
||||
['<C-e>'] = function(fallback)
|
||||
fallback()
|
||||
end,
|
||||
-- ['<CR>'] = cmp.mapping.confirm({
|
||||
-- behavior = cmp.ConfirmBehavior.Replace,
|
||||
-- select = true,
|
||||
-- }),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
-- ['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
--},
|
||||
}),
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user