From 643d282bac402fe83eab17d7e3847313463e5860 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 Mar 2023 10:26:06 +0100 Subject: [PATCH] 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). --- nvim/.config/nvim/lua/plug/_lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/.config/nvim/lua/plug/_lsp.lua b/nvim/.config/nvim/lua/plug/_lsp.lua index 6ac022f..ce866a8 100644 --- a/nvim/.config/nvim/lua/plug/_lsp.lua +++ b/nvim/.config/nvim/lua/plug/_lsp.lua @@ -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 }), [""] = cmp.mapping(function(fallback) if cmp.visible() then