🐛 Bug(blink.cmp): cmdline min keyword length

Cleaner cmdline completion with ghost-text and require a minimum of 2 characters entered before
showing suggestions. This prevents `:q` from being autocompleted to `:qall` and similar
mis-completions for short cmds.
This commit is contained in:
2025-03-01 11:07:16 -05:00
parent 98a72eab61
commit 1a5b574ef6
+19 -1
View File
@@ -69,7 +69,10 @@ if vim.g.useblinkcmp then
},
cmdline = {
enabled = true,
completion = { menu = { auto_show = true } },
completion = {
menu = { auto_show = true },
ghost_text = { enabled = true },
},
sources = function()
local type = vim.fn.getcmdtype()
-- Search forward and backward
@@ -90,6 +93,21 @@ if vim.g.useblinkcmp then
['<Enter>'] = { 'accept_and_enter', 'fallback' },
},
},
sources = {
providers = {
cmdline = {
min_keyword_length = function(ctx)
-- when typing a command, only show when the keyword is 2 characters or longer
if
ctx.mode == 'cmdline' and string.find(ctx.line, ' ') == nil
then
return 2
end
return 0
end,
},
},
},
},
keys = require('data.keys').blink,
},