Searchlight = Search + Highlight
Vim-searchlight highlights Vim's current search match.
Vim 8.2.4724+ supports CurSearch
, as well as NeoVim 0.10+. In this case the Searchlight
highlight group is linked to CurSearch
and the rest of the plugin is disabled.
Searchlight requires 'hlsearch'
to be active and Vim 8+ with timer support. It is tested on Vim 8.1.
Searchlight is an experiment. Your mileage my vary. Might not work with other plugins or your vimrc
.
Follow your favorite plugin/runtimepath manager's instructions.
If you choose manual installation, use Vim's packages. Clone into one of the following directories:
$HOME/.vim/pack/bundle/start/ on Unix-like systems
$HOME\vimfiles\pack\bundle\start\ on Windows
Use :Searchlight
to enable and :Searchlight!
to disable.
Searchlight uses the Searchlight
highlight group. It defaults to ErrorMsg
. Change by doing:
highlight link Searchlight Incsearch
Searchlight's highlighting can be triggered manually via :1Searchlight
. This might be required for some mappings or plugin compatibility.
Searchlight is activated by default on startup. To prevent this set g:searchlight_disable_on_startup
. e.g.
let g:searchlight_disable_on_startup = 1
This is an experiment to implement current search highlighting without any mappings. Thank-you to both vim-searchhi & vim-searchant which inspired this plugin.
When using any search command like: *
, #
, etc at the beginning of a match and it is the only match and therefore will not cause the cursor to move, will not trigger searchlight.
One solution would be to trigger an update with mappings like so:
nnoremap <silent> * *:1Searchlight<cr>
nnoremap <silent> # #:1Searchlight<cr>
However, this goes against the goal of having no mappings. Sad panda