Wednesday, March 1, 2017

Re: highlight a word following a certain key

On 2017-03-01 00:41, sinbad wrote:
> i want to hightlight a word following a certain word. For instance.
> In the below example, i want to highlight the words that appear
> after 'key' which are one, two and three. how can i do that?
>
> 1.txt:
>
> key one
> key two
> abc def
> key three

If you don't mind highlighting the "key" too, you can just use

/\<key\s\+\w\+

If you don't want the key and the space, you can use

/key \+\zs\w\+

or

/\(key \+\)\@<=\w\+

which both do the same sort of thing. I'm partial to the former
method as it's a little shorter and easier for me to understand.

-tim



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment