I’d like to highlight certain part of the text before the cursor and certain part of the text after the cursor.
The parts before and after the cursor will be defined by some pattern (like regular expression). This pattern should not be limited by line.
The highlighted area will change as the cursor will move.
Is this possible in vim settings or script?
Theoretically, both of the following commands should work:
. Eventually, with both commands I observe a bug: highlight is not updated properly until I hit
<C-l>. More, with:syn matchit sometimes highlights two different parts of two different sentences, so first one is more preferred (also see:h matchadd()and:h 2matchbecause:matchhighlighting may disappear because it AFAIR is used also by something else).Update: Though due to the bug described above I would not recommend adding it to the vimrc, you can use the following: