Showing posts with label regex. Show all posts
Showing posts with label regex. Show all posts

Friday, April 4, 2008

Search and Replace on VIM

1. Search and Replace All (Easiest)

Esc
:%s/old_pattern/new_pattern/g

2. Search and Replace selected

(a) Esc
(b) /old_pattern
(c) Go to desired by pressing n again and again
(d) Press cw (Change Word) and type
(e) Esc
(f) Press n to go to next old_pattern
(g) Press . if you want to do repeat last command used in step (c)

(h) Go to step (f), until all desired changes are made