From 082808842128275df8a85b2884bb9dacfc85dea2 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 25 Jan 2022 23:11:35 +0100 Subject: [PATCH] vim: avoid toggling the search highlight option I usually want to clear the highlights after doing whatever the reason for the search was, but having to re-enable it all the time was annoying. So, using `:nohlsearch` fixes that, as this command does exactly what I actually wanted all along. --- nvim/.config/nvim/lua/fs/keymaps.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/lua/fs/keymaps.lua b/nvim/.config/nvim/lua/fs/keymaps.lua index e148b35..8e49e34 100644 --- a/nvim/.config/nvim/lua/fs/keymaps.lua +++ b/nvim/.config/nvim/lua/fs/keymaps.lua @@ -62,8 +62,8 @@ register { -- quickly change background M('n', 'bg', [[:let &background = &background ==? 'light' ? 'dark' : 'light']]), - -- toggle search highlight - M('n', 'h', ':set hlsearch!'), + -- disable highlight until next search + M('n', 'h', ':nohlsearch'), -- toggle NERDTree M('n', 'n', ':NERDTreeToggle'),