From c07ddfe945872d409840d79c029f6124e117391e Mon Sep 17 00:00:00 2001 From: Nathan Zeng Date: Sun, 29 Nov 2026 17:09:46 -0800 Subject: [PATCH] fix(keymaps): remap functionality into Problem: We use `` for window navigation, but it is also the only way to clear multicursors when in neovim 0.13. Solution: Create a mapping for `` that performs `` as well as `` default behavior. NOTE: probably wait for 0.13 stable release to merge this. --- init.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 560c183337e..c1a57374b39 100644 --- a/init.lua +++ b/init.lua @@ -181,10 +181,6 @@ do -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` - -- Clear highlights on search when pressing in normal mode - -- See `:help hlsearch` - vim.keymap.set('n', '', 'nohlsearch') - -- Diagnostic Config & Keymaps -- See `:help vim.diagnostic.Opts` vim.diagnostic.config { @@ -240,6 +236,18 @@ do -- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) -- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) + -- Since we are using CTRL-L for window navigation, add default CTRL-L functionality to CTRL-C + -- See `:help CTRL-L-default` + vim.keymap.set( + 'n', + '', + 'nohlsearch' + .. 'diffupdate' + .. 'call nvim_buf_clear_namespace(0, nvim_create_namespace("nvim.multicursor"), 0, -1)' + .. 'normal! ', + { desc = 'Clear pending command and search highlighting, update diffs, remove multicursors' } + ) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands`