TravelTrader
TravelTrader

Reputation: 408

How to highlight second part of a search string with a colon?

Today I have to ask some of the problems I could not solve by trial and error:

In vim I need to highlight just the second word after a search string divided by a colon:

partA:partB

Just "partB" should be highlighted and the whole expression should be searched. I use !\zs\w\+\ze in my system and therefore I experimented with these additional limiters. At the moment I tried

\(solved:)(Yes\|No\|Almost\)\>

but I only want Yes, No or Almost highlighted. Thanks a lot.

Upvotes: 1

Views: 135

Answers (2)

TravelTrader
TravelTrader

Reputation: 408

After trying a lot of combinations I found the solution in my case for myself:

'solved:\zs\w*'

Why this works and not Kents fast answer I don't know. But this is the line I now use.

Upvotes: 0

Kent
Kent

Reputation: 195059

You don't need do those grouping, this should do what you wanted:

/solved:\zs\w\+

see the screenshot:

enter image description here

Upvotes: 6

Related Questions