nvim: fix cmdline path completions
This commit is contained in:
parent
8fe54e3d2b
commit
9008b44324
1 changed files with 22 additions and 12 deletions
|
@ -152,18 +152,6 @@ M.cmp = function()
|
||||||
{ name = 'cmdline' },
|
{ name = 'cmdline' },
|
||||||
{ name = 'emoji' },
|
{ 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 = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
-- fancy icons and a name of kind
|
-- fancy icons and a name of kind
|
||||||
|
@ -196,6 +184,28 @@ M.cmp = function()
|
||||||
ghost_text = true,
|
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 -- <<<
|
end -- <<<
|
||||||
|
|
||||||
-- lspconfig >>>
|
-- lspconfig >>>
|
||||||
|
|
Loading…
Add table
Reference in a new issue