Reputation: 62568
In Vim, how do I highlight (match, to be precise) only the angular brackets and their contents if they are at the beginning of a line, in the following
[1-2-A 3.2.1.] Text goes here ... some more text ...
which then continues here. [This should not be highlighted]
Some more text here.
The second pair should not be highlighted.
I'd appreciate any help on this one!
Upvotes: 2
Views: 317
Reputation: 161914
This short pattern works:
/^\[.*\]
Long version(if nested brackets are not allowed):
/^\[[^][]*\]
Non-greedy version
^\[.\{-}\]
Upvotes: 5