VIM Editor

Searching in VIM

Tagged:  

In this tutorial I explain how to search and replace strings in VIM. VIM is the best tool for programmers. It supports almost all languages (may exclude VB, VC, VC++).

Its a superb editor with tons of features. Yeah a little complicated thing for newbies. But you have their full support mailing list, vimtutor - the application which teaches you VIM online (not on the web!).

So how to search and replace strings in VIM ?

Searching-

There are two ways to search - forward and backward.

Searching forward means from the point where you are currently to the end of the file.

Searching backward means from the point where you are currently to the top of the file.

To search forward,

Exit Insert Mode by pressing Escape key. This will make VIM work on command mode.

Type

/

If you have spaces in you must escape them with a backslash(\).

For Ex: /WORD1\ WORD2

The above command will search for WORD1 WORD2 (note the space in the words).

To search backward all steps are same except instead of / you use ? (question mark).

To Find Next, (forward) press n, (backward) press N [Shift+N].

You can also use Regular Expressions in search string. More about searching in next tutorial.

Download VIM: VIM.ORG

Syndicate content
All trademarks and copyrights on this page are owned by their respective owners. Comments are owned by the Poster. Rest Copyright © iTech7.com

For License and Copyrights see http://www.itech7.com/Content-Copyrights