I am writing a plugin that highlights buffer settings violations.
I use matchadd()
function. In addition I need to add patterns that are force ignored. In order to achieve that I use priorities in matchadd()
.
I use the following highlight group to highlight trailing spaces:
highligh FileStyleTrailngSpacesError ctermbg=Cyan guibg=Cyan
Matching trailing spaces code:
matchadd('FileStyleTrailngSpacesError', '\s\+$', 1)
Force highlight disabling supposed to be (e.g. pattern >\s\+$
):
matchadd('Normal', '>\s\+$', 1)
The problem is that this line of code does not disable highlight, but it "works" with other highlight groups e.g. Todo
I also tried to use the following groups:
" Has the same result as 'Normal'
highligh FileStyleIgnorePattern cterm=NONE guibg=NONE
" E420: BG color unknown
highligh FileStyleIgnorePattern ctermbg=bg guibg=bg
UPDATE: OS - Ubuntu 14.04
matchadd()
. Perhaps a better approach might be to keep a list of IDs and delete the relevant ones rather than make them do nothing.\s\+$
and>\s\+\$
that should be ignored).