update: nvim: add path & cmdline cmp

This commit is contained in:
qwjyh 2023-03-12 23:50:09 +09:00
parent 3875bb2a74
commit d7b7044536

View file

@ -34,7 +34,10 @@ require('lazy').setup({
'hrsh7th/cmp-nvim-lsp', -- LSP 'hrsh7th/cmp-nvim-lsp', -- LSP
'L3MON4D3/LuaSnip', -- snippets 'L3MON4D3/LuaSnip', -- snippets
'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip 'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip
'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words
'kdheepak/cmp-latex-symbols', -- latex math 'kdheepak/cmp-latex-symbols', -- latex math
'hrsh7th/cmp-path', -- nvim-cmp source for filesystem paths
'hrsh7th/cmp-cmdline', -- command line
}, },
}, },
{ {
@ -233,14 +236,40 @@ cmp.setup {
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'buffer' },
{ {
name = 'latex_symbols', name = 'latex_symbols',
option = { option = {
strategy = 0, -- mixed (show the comand and insert the symbol) strategy = 0, -- mixed (show the comand and insert the symbol)
}, },
}, },
{ name = 'path' },
}, },
} }
-- cmdline completions
-- `/` cmdline setup.
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- ':'
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{
name = 'cmdline',
option = {
ignore_cmds = { 'Man', '!' }
}
}
})
})
----------------------------------------------------------- -----------------------------------------------------------