refactor(nvim): improve cmp completions
This commit is contained in:
parent
ad93d9dfae
commit
add4f4bac5
@ -120,28 +120,29 @@ return {
|
|||||||
sources = sources or {}
|
sources = sources or {}
|
||||||
local default_sources = {
|
local default_sources = {
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "luasnip" }, -- For luasnip users.
|
{ name = "luasnip", max_item_count = 5 }, -- For luasnip users.
|
||||||
|
{ name = "async_path" },
|
||||||
{
|
{
|
||||||
name = "fuzzy_buffer",
|
name = "fuzzy_buffer",
|
||||||
|
max_item_count = 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "rg",
|
name = "rg",
|
||||||
keyword_length = 3,
|
keyword_length = 3,
|
||||||
max_item_count = 10,
|
max_item_count = 5,
|
||||||
option = {
|
option = {
|
||||||
"--smart-case",
|
"--smart-case",
|
||||||
"--hidden",
|
"--hidden",
|
||||||
"--max-depth 4",
|
"--max-depth 4",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ name = "async_path" },
|
|
||||||
{
|
{
|
||||||
name = "lua-latex-symbols",
|
name = "lua-latex-symbols",
|
||||||
option = { cache = true },
|
option = { cache = true },
|
||||||
trigger_characters = { "\\" },
|
trigger_characters = { "\\" },
|
||||||
},
|
},
|
||||||
{ name = "zsh" },
|
{ name = "zsh", max_item_count = 5 },
|
||||||
{ name = "emoji", keyword_length = 2 },
|
{ name = "emoji", keyword_length = 2, max_item_count = 10 },
|
||||||
{ name = "calc" },
|
{ name = "calc" },
|
||||||
{ name = "npm", keyword_length = 2 },
|
{ name = "npm", keyword_length = 2 },
|
||||||
}
|
}
|
||||||
@ -400,23 +401,12 @@ return {
|
|||||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||||
cmp.setup.cmdline("/", {
|
cmp.setup.cmdline("/", {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({ name = "fuzzy_buffer" }),
|
||||||
{ name = "fuzzy_buffer" },
|
|
||||||
{ name = "rg" },
|
|
||||||
}),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
cmp.setup.cmdline("?", {
|
cmp.setup.cmdline("?", {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = cmp.config.sources({ { name = "rg" } }),
|
sources = cmp.config.sources({ name = "fuzzy_buffer" }),
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.cmdline("@", {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = "rg" },
|
|
||||||
{ name = "cmdline_history", max_item_count = 3 },
|
|
||||||
}),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
@ -430,8 +420,7 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ name = "cmdline_history", max_item_count = 3 },
|
{ name = "cmdline_history", max_item_count = 3 },
|
||||||
{ name = "fuzzy_buffer" },
|
{ name = "fuzzy_buffer", max_item_count = 3 },
|
||||||
{ name = "rg" },
|
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user