feat(nvim): disable cmp for IncRename

nixos
Moritz Böhme 2023-09-07 08:45:50 +02:00
parent 116fc30524
commit 12a5420ee9
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
1 changed files with 11 additions and 0 deletions

View File

@ -76,6 +76,17 @@ cmp.setup.cmdline(":", {
}, { }, {
{ name = "cmdline" }, { name = "cmdline" },
}), }),
enabled = function()
-- Set of commands where cmp will be disabled
local disabled = {
IncRename = true,
}
-- Get first word of cmdline
local cmd = vim.fn.getcmdline():match("%S+")
-- Return true if cmd isn't disabled
-- else call/return cmp.close(), which returns false
return not disabled[cmd] or cmp.close()
end,
}) })
-- If you want insert `(` after select function or method item -- If you want insert `(` after select function or method item
local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp")