Is there a way to make vim display "virtual characters" before/after regular patterns in the buffer?
- by Laurence Gonsalves
Vim has list and listchars options that make vim display "virtual characters" (by which I mean characters that aren't actually in the buffer) in certain situations. For example, you can make trailing spaces look like something else, or add a visible character to represent the newline character.
I'd like to be able to enable the display of certain characters either before or after certain regular patterns ((perhaps syntax items). Sort of like syntax highlighting, but instead of just changing the color/styling of characters that are in the buffer, I'd like to display extra characters that aren't in the buffer.
For example, I'd like to display a virtual : (colon) after all occurrences of the word "where" that appear at the end of a line.
Is this possible, and if so, what is the necessary vimscript to do it?