Skip to content

PeterRincker/vim-searchlight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-searchlight

Searchlight = Search + Highlight

Vim-searchlight highlights Vim's current search match.

alt text

CurSearch

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.

Requirements

Searchlight requires 'hlsearch' to be active and Vim 8+ with timer support. It is tested on Vim 8.1.

Experimental

Searchlight is an experiment. Your mileage my vary. Might not work with other plugins or your vimrc.

Installation

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

Commands

Use :Searchlight to enable and :Searchlight! to disable.

Customization

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

Background

This is an experiment to implement current search highlighting without any mappings. Thank-you to both vim-searchhi & vim-searchant which inspired this plugin.

Known Issues

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

About

Highlights the current search match

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published