tags:

views:

280

answers:

2

I can search word in vim with /word. How can I exclude searches for word1, word2 and only search for word.

+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
beaten by 19 seconds :) +1
roe
placing your cursor over a word and pressing * (forward) or # (backward) is a shortcut
roe
yes, I tried to be fast :)
Nathan Fellman
+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