Is there a less fantastically kludgy way to make one-time highlights in Vim?

I am. Problem

My goal is to:

I have a line of text like

Who left the dead mouse in the fridge?

and I want to highlight the first in thegreen, only this one occurrence. That is, I do not want syn match ThisMagicWord "\<the\>"or anything that will overly highlight the other thes.

There is another requirement that if the user edits another text in a line, say

Who on earth left the delicious dead mouse in the fridge?

highlighting will be tracked with the word theif the user does not edit that particular word.

II. Kludge

Now I have a solution. In fact, I am proud of my decision because it was hard to come up with. But this is not for any part of the imagination a good decision.

, Unicode Grapheme Joiner Vim. . , . , ,

Who left the<CGJ> dead mouse in the fridge?

syn match ThisMagicWord "the<CGJ>"

BufWritePre BufWritePost, CGJ .

III.

  • Vim no-op ( ), CGJ? , the<CGJ> /the, - , Vim .

  • , ?

+4
2

, , . , kludge: / ( \%l \%v) ( ) diff.

Unicode , ( ) . , /. , , , vim_dev ( ). ( Vim), /Vimscript. Vim ( ) , , .

+2

?

, (, mz), \%'zthe

0

All Articles