cmp-cmdline icon indicating copy to clipboard operation
cmp-cmdline copied to clipboard

completion for `:set no...` doesn't work

Open zsrkmyn opened this issue 5 months ago • 1 comments

I saw there's a closed issue #44 to support this feature, but I still cannot make it work using the latest version. The only completion I got was nrformats after typing set no. See screenshot below.

Image

I debugged for a while and found that vim.fn.getcompletion('set no', 'cmdline') returned the correct results, but got no idea why they were not showed.

$ nvim --version
NVIM v0.11.4
Build type: RelWithDebInfo
LuaJIT 2.1.1753364724
Run "nvim -V1 -v" for more info
$ git -C ~/.vim/pack/completion/start/nvim-cmp log -1 --oneline
b5311ab (HEAD -> main, origin/main, origin/HEAD) fix missing required fields in formatting config (#2040)
$ git -C ~/.vim/pack/completion/start/cmp-cmdline log -1 --oneline
d126061 (HEAD -> main, origin/main, origin/HEAD) Merge pull request #129 from enlewof/patch-1

zsrkmyn avatar Sep 07 '25 10:09 zsrkmyn

It worked after I removed the filterText. I have no idea why it was set. The matcher failed to match the input nowr when the filterText was set to wrap.

If it's the correct fix, I'd like to file a PR.

diff --git a/lua/cmp_cmdline/init.lua b/lua/cmp_cmdline/init.lua
index 53e7593..20ba8bf 100644
--- a/lua/cmp_cmdline/init.lua
+++ b/lua/cmp_cmdline/init.lua
@@ -140,7 +140,6 @@ local definitions = {
         if is_option_name_completion and is_boolean_option(word) then
           table.insert(items, vim.tbl_deep_extend('force', {}, item, {
             label = 'no' .. word,
-            filterText = word,
           }))
         end
       end

zsrkmyn avatar Sep 07 '25 11:09 zsrkmyn