asiryk / auto-hlsearch.nvim

Automatically manage hlsearch setting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

auto-hlsearch.nvim

Automatically manage hlsearch setting.

Preview

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

Getting Started

Installation

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.

Usage

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.

About

Automatically manage hlsearch setting

License:Apache License 2.0


Languages

Language:Lua 100.0%