Vi : Search and Replace

Change to normal mode with escape key.


Search STRING forward :

Search STRING backward:

Repeat search: n
Repeat search in opposite direction: N (SHIFT-n)

Replace: Replace OLD with NEW:

First occurrence on current line:

Globally (all) on current line:

Between two lines #,#:

Every occurrence in file:

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.