vimhighlight

Vim words syntax highlighting


How can I in Vim highlight, e.g., the first 10 words in a line ?

I have found in Stackoverflow the answer for the first word :

/^\s*\w\+/

but I cannot figure how to tinker it for 10 words, or any number of words, by the way.


Solution

  • Does this help?

    /\v^\s*(<\w+>\s*){,5}
    

    In the screenshot, it "highlights" 0-5 words as an example.

    enter image description here