Automatically manage hlsearch setting.
Activates the hlsearch
option when you start searching e.g. with key /
. Deactivates the hlsearch
when you move the cursor, so you don't have to think about enabling/disabling it manually.
auto-hlsearch-demo.mp4
Note: it is possible to turn off the plugin with
:AutoHlsearchDisable
and turn on with:AutoHlsearchEnable
commands
Neovim >=0.8.0 is recommended.
The plugin can be installed using any plugin manager. An example using packer.nvim:
use({ "asiryk/auto-hlsearch.nvim", tag = "1.1.0" })
Note: It is recommended to specify the tag.
In order to use the plugin, it is required to call setup()
. The following line will use default settings:
require("auto-hlsearch").setup()
The default configuration options:
require("auto-hlsearch").setup({
remap_keys = { "/", "?", "*", "#", "n", "N" },
create_commands = true,
pre_hook = function() end,
post_hook = function() end,
})
The plugin introduces a user command :AutoHlsearch
which would be prepended to the provided remap_keys
.
pre_hook
and post_hook
functions will activate before/after searching.
For more information read help :h auto-hlsearch.nvim
.