Skip to content

antoinemadec/vim-highlight-groups

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

highlight-groups.vim

Add the word under the cursor in different highlight groups.

Each group has a different color.

Installation

Use your favorite plugin manager.

Using vim-plug:

Plug 'antoinemadec/vim-highlight-groups'

Quick start guide

Add this in your .vimrc:

nnoremap <silent> <F5>     :HighlightGroupsAddWord    13 1<CR>
nnoremap <silent> \<F5>    :HighlightGroupsClearGroup 13 1<CR>
nnoremap <silent> <F6>     :HighlightGroupsAddWord    17 1<CR>
nnoremap <silent> \<F6>    :HighlightGroupsClearGroup 17 1<CR>

Complete API

To highlight the word under the cursor:

:HighlightGroupsClearGroup <group_nb> <all_window>
:HighlightGroupsAddWord    <group_nb> <all_window>

Core functions:

" function MatchAdd(group_name, hl, pattern, priority)
" function MatchDelete(group_name)
call MatchAdd('my_own_group', 'IncSearch', '\s\+$', 11)
call MatchAdd('my_own_group', 'Error', 'compilation failed', 11)
call MatchDelete('my_own_group')

License

Copyright (c) Antoine Madec. Distributed under the same terms as Vim itself. See :help license.