This tiny Vim/Neovim plugin lets you toggle a highlight. In normal mode and linewise visual mode the highlights are toggled linewise. In characterwise visual mode the highlights are characterwise.
Highights will stay with their text if lines earlier in the buffer are inserted or deleted.
Requires Vim 8.1.0579+.
Install using your favourite package manager, or use Vim's built-in package support:
mkdir -p ~/.vim/pack/airblade/start
cd ~/.vim/pack/airblade/start
git clone https://github.com/airblade/vim-highline.git
vim -u NONE -c "helptags vim-highline/doc" -c q
Map a key sequence, for example <Leader>h
, to the toggle and clear functions:
nmap <Leader>h <Plug>(HighlineToggle)
xmap <Leader>h <Plug>(HighlineToggle)
nmap <Leader>c <Plug>(HighlineClear)
The highlight used is defined by the Highline
group which by default links to Visual
. Feel free to link it to a different group or define your own colours, in your vimrc / init.vim. For example:
highlight link Highline Pmenu
– or:
highlight Highline guibg=#444444
Copyright 2021 Andrew Stewart. Released under the MIT licence.