I use a couple of auto commands to do highlighting of extraneous whitespace in my vim setup on InsertLeave
and BufReadPost
events. I recently started using a plugin to highlight indentation as well (https://github.com/nathanaelkane/vim-indent-guides)
The issue is that if there is an empty line with indentation, it gets highlighted by the indent-guides plugin but not by my auto commands. What I would like to do is add a custom event to the plugin so that when it is done highlighting I can set my autocommands to trigger and overwrite that highlighting in the cases where it should.
For example, this is the type of flow I would like (or at least something similar):
indent-guides plugin activates
indent-guides plugin highlights all indentation
indent-guides plugin triggers custom event signaling it is done
indent-guides plugin exits
auto command whitespace highlighter is triggered by indent-guides completion event
Here are the auto commands I am using for whitespace highlight:
autocmd InsertEnter * syn clear EOLWS | syn match EOLWS excludenl /\s\+\%#\@!$/
autocmd InsertLeave,BufReadPost * syn clear EOLWS | syn match EOLWS excludenl /\s\+$/
EDIT:
I have solved this issue another way (by editing a different plugin). This still doesn't answer this specific question, so I won't be posting that as a solution.
My solution to the problem as a plugin: https://github.com/ntpeters/vim-better-whitespace