nvim: Improve cmdline completion

When completing in command line I want the completion canditates to be
displayed, but *not* selected on confirmation. By doing so, it makes it
almost impossible to quickly quit with ':q' or write with ':w' for
example, as those always try to expand themselves automatically into
completion items.

This commit changes the default behavior for command mode to show
completions but not auto accept any on confirmation, instead simply
invoking whatever is currently on the command line (as if we had no
completion plugin running).
This commit is contained in:
Marty Oehme 2023-03-22 10:26:06 +01:00
parent ce9f101024
commit 643d282bac
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -161,7 +161,7 @@ cmp.setup({
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }), -- disable selection in cmd mode
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then