Reputation: 1316
Sometimes I just want to highlight the keyword on specific lines. Since the keyword is really common, it can appear everywhere in the file.
For instance, I'm searching for 1
s on lines starting with check
in the following file:
...
[block-1]
test 31 for instruction block1_test
stim 011000011100101
check xxxxx1xxxx1xxxx
...
Using /1
will highlight every 1
, and makes it a bit annoying to find the one I want.
Though using /^check\>.*1
narrowers the search result, it matchs from the very beginning to the last 1
on that line.
I'd like to make all the 1
s on check
lines clearer to see, to find. Can I achieve this?
Upvotes: 1
Views: 96
Reputation: 8908
You can use a look-behind operator \@<=
in your pattern to match 1
but only in lines that start with check
.
This search pattern does what you requested:
/\(^check\>.*\)\@<=1
Using "very magic" option :h magic
:
/\v(^check .*)@<=1
Upvotes: 1