nvim: fix cmdline path completions

This commit is contained in:
PowerUser64 2022-06-15 19:53:05 -07:00
parent 8fe54e3d2b
commit 9008b44324

View file

@ -152,18 +152,6 @@ M.cmp = function()
{ name = 'cmdline' },
{ name = 'emoji' },
},
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
}),
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' },
{ name = 'cmdline' }
}),
}),
formatting = {
format = function(entry, vim_item)
-- fancy icons and a name of kind
@ -196,6 +184,28 @@ M.cmp = function()
ghost_text = true,
}
}
-- Thanks to iwataka on github for this bit
local search_config = {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' },
}
}
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', search_config)
cmp.setup.cmdline('?', search_config)
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
end -- <<<
-- lspconfig >>>