astro-nvim-v3 - add cmp on cmdlines

This commit is contained in:
huyjaky
2025-01-17 00:29:25 +07:00
parent 7fd986783a
commit 48552a05a6
5 changed files with 52 additions and 22 deletions

View File

@@ -8,6 +8,9 @@ return {
{
"github/copilot.vim",
},
{
"hrsh7th/cmp-cmdline",
},
{
"hrsh7th/nvim-cmp",
opts = function(_, opts)
@@ -19,6 +22,29 @@ return {
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
end
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{
name = "cmdline",
option = {
ignore_cmds = { "Man", "!" },
},
},
}),
})
cmp.setup.filetype("python", {
sources = cmp.config.sources {
{ name = "nvim_lsp", priority = 1000 },