Global search and replace
Replace all occurrences interactively (c = confirm)
:%s/old/new/gc
- tool
- vim10 commands
More vim commands
-
vim +42 file.txtStart vim with cursor on line 42
-
/pattern (n/N next/prev) ?pattern (backward)/ searches forward, ? searches backward; n/N cycle results
-
:g/^#/dDelete all lines starting with # (comment lines)
-
gg=GGo to top (gg), re-indent to end of file (=G)
-
qa (record into a) q (stop) @a (play) 10@a (play 10 times)Macros automate repetitive edits in vim