tags:

views:

96

answers:

2

I use Vim to read man pages. But I'm having trouble searching for variables. For example I use:

/\<-s\>

to search for '-s', but it doesn't find anything. Grrr. I see it in the file. What am I doing wrong?

+2  A: 

/-s works just fine for me.

Aaron Maenpaa
The problem is I want it word-delimited. There are lots of -s strings there.
Leonard
":set hi" and "nnnnnnnnn..." are your friends. I mean seriously, how many "-s"s are you going to see? A hundred?
Aaron Maenpaa
Though on second thought... It is nice to know *why* the regexp you posted didn't work. Thanks Brian.
Aaron Maenpaa
+7  A: 

\< matches the beginning of a word, and - normally isn't considered a word character. Do :set iskeyword? to see what characters are considered word characters.

Try this:

:set iskeyword+=-
/\<-s\>

Should work then. See :h /\< and :h 'iskeyword'.

Brian Carper
Perfect. Thanks.
Leonard
Brian is the only man who should provide the answer to the emacs vs. vim debate.
ojblass