Linux VIM : usefull search tips and tricks

Posted: April 11, 2013 in linux, vim
Tags: , ,
  • Search for a word
/search_word
  • Search ignore case
/\csearch_word
  • Incremental search

With incremental search you can view the matches as you type, no need to type the whole word.

:set incsearch
  • Highlight search matching word.
:set hlsearch
  • Smartcase

Search case sensitively if caps letters are in search pattern.

:set ignorecase smartcase
  • Type “*”  to search for the word under the cursor
  • Search for whole word
\<search_term\>

Here “/<” represents the start of the word and “\>” represents the end of the word

Advertisements
Comments
  1. Harsha says:

    vim open file for given name (with wildcard)

    vim $(find . -name “*filename*”)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s