nullromo / cash.nvim

Adds additional search registers to Neovim
Other
3 stars 0 forks source link

Add toggle-able feature for disabling persistent highlighting #16

Open nullromo opened 5 months ago

nullromo commented 5 months ago

Problem

After searching (/) and navigating (n/N), some users want the highlighting to go away.

Solution

Keep the highlighting around (like vim does by default), but then disable it (call :noh) when the cursor is moved.

Features

This should be settable via a plugin option and should also be toggleable (enable/disable/toggle) in real time with commands.

References

Reference plugin for non-neovim

Reference implementation

nullromo commented 1 month ago

I currently use <C-/> for this:

-- Use <C-/> as a shortcut for :nohlsearch to hide the search highlighting
vim.keymap.set('n', '<C-/>', function()
    vim.cmd.nohlsearch()
end)