Creating a custom event in Vim

I use a couple of automatic commands to highlight extra spaces in my vim settings on InsertLeaveand events BufReadPost. I recently started using a plugin for indenting ( https://github.com/nathanaelkane/vim-indent-guides )

The problem is that if there is an empty indented line, it is highlighted by the indentation plugin, and not by my automatic commands. What I would like to do is add a custom event to the plugin so that when this is done, the backlight, I can configure the auto command to start and overwrite this backlight in cases where it should.

For example, this is the type of stream I would like (or at least something like that):

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 autocommands that I use to highlight spaces:

autocmd InsertEnter * syn clear EOLWS | syn match EOLWS excludenl /\s\+\%#\@!$/
autocmd InsertLeave,BufReadPost * syn clear EOLWS | syn match EOLWS excludenl /\s\+$/

EDIT:

( ). , .

: https://github.com/ntpeters/vim-better-whitespace

+3
1

VIM , . , , , .

autocmd:

autocmd User MyCustomEvent call my_custom_function()

autocmd:

doautocmd User MyCustomEvent

doautocmd , autocmd, , vim, , . autocmds , , , autommds vim .

+4

All Articles