cmp-cmdline
cmp-cmdline copied to clipboard
disable completion for specific cmdline commands. eg: Man
Why the feature is needed?
@Shougo I currently enabled cmdline completion using this snippet from README.
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
However neovim is choking when completing commands like :Man
I figured this is because Man command usually returns a very long list. Is there anyway to disable cmdline completion say for example only on the Man
command?
Hm.. You can use keyword_pattern
for it.
https://github.com/hrsh7th/nvim-cmp/issues/821#issuecomment-1056160923
I'm not quite familiar with regular expression, could you give a sample.
I think it should work.
cmp.setup.cmdline(':', {
sources = {
{name = 'path'},
-- Do not show completion for words starting with 'Man'
{name = 'cmdline', keyword_pattern = [[^\@<!Man\s]]},
}
})
Meet same problem here. Could it possible to specify separate keyword length for the command to reduce the completion list size?
:help cmp-config.completion.keyword_length
help cmp-config.sources[n].keyword_length
This controlled whether the completion started with the whole commandline.
What I mean here is that consider the arguments size of command, for example, Man
won't complete while Man m
will do complete if length set to 1.
Hm.
*cmp-config.sources[n].max_item_count*
sources[n].max_item_count~
`number`
The source-specific item count.
Is there any way to get source conf? Thus I could add some conf to verify the command argument length.
Fixed. You can modify ignore_cmds
option.
It doesn't work. How do you use it? Perhaps document it's usage?