Vim quick reference

From thelinuxwiki
Revision as of 19:01, 25 February 2013 by Nighthawk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


search and replace

Change each 'foo' to 'bar' in the current line

:s/foo/bar/g 	

Change each 'foo' to 'bar' in all lines

:%s/foo/bar/g 	

Change each 'foo' to 'bar' for all lines from line 5 to line 12 inclusive

:5,12s/foo/bar/g