🐛 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:
+19
-1
@@ -69,7 +69,10 @@ if vim.g.useblinkcmp then
|
|||||||
},
|
},
|
||||||
cmdline = {
|
cmdline = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
completion = { menu = { auto_show = true } },
|
completion = {
|
||||||
|
menu = { auto_show = true },
|
||||||
|
ghost_text = { enabled = true },
|
||||||
|
},
|
||||||
sources = function()
|
sources = function()
|
||||||
local type = vim.fn.getcmdtype()
|
local type = vim.fn.getcmdtype()
|
||||||
-- Search forward and backward
|
-- Search forward and backward
|
||||||
@@ -90,6 +93,21 @@ if vim.g.useblinkcmp then
|
|||||||
['<Enter>'] = { 'accept_and_enter', 'fallback' },
|
['<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,
|
keys = require('data.keys').blink,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user