Tuesday, April 5, 2011

Searching word in vim?

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

From stackoverflow
  • 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.

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

0 comments:

Post a Comment