I can search word in vim with /word
. How can I exclude searches for word1, word2 and only search for word.
views:
280answers:
2
+21
A:
like this:
/\<word\>
\<
means beginning of a word, and \>
means the end of a word,
Adding @Roe's comment:
VIM provides a shortcut for this. If you already have word on screen and you want to find other instances of it, you can put the cursor on the word and press '*'
to search forward in the file or '#'
to search backwards.
Nathan Fellman
2009-01-19 19:51:19
beaten by 19 seconds :) +1
roe
2009-01-19 19:52:16
placing your cursor over a word and pressing * (forward) or # (backward) is a shortcut
roe
2009-01-19 19:53:03
yes, I tried to be fast :)
Nathan Fellman
2009-01-19 19:53:08
+1
A:
I usually google my trusty vim cheat sheets whenever I go a long time without using it.
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html http://www.tuxfiles.org/linuxhelp/vimcheat.html
Mongo
2009-01-19 20:35:35