From 12a5420ee928e05fddb522aad77a8a52874e52b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Thu, 7 Sep 2023 08:45:50 +0200 Subject: [PATCH] feat(nvim): disable cmp for IncRename --- modules/programs/nvim/plugins/nvim-cmp.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/programs/nvim/plugins/nvim-cmp.lua b/modules/programs/nvim/plugins/nvim-cmp.lua index 500a3a9..1a8a070 100644 --- a/modules/programs/nvim/plugins/nvim-cmp.lua +++ b/modules/programs/nvim/plugins/nvim-cmp.lua @@ -76,6 +76,17 @@ cmp.setup.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 local cmp_autopairs = require("nvim-autopairs.completion.cmp")