Search and replace in the whole file
Replace all matches and confirm each one (c)
:%s/old/new/gc
- tool
- vim10 commands
More vim commands
-
vim +42 file.txtStart vim with the cursor on line 42
-
/pattern (n/N next/prev) ?pattern (backward)/ searches forward, ? searches backward, n/N go to the next or previous match
-
:g/^#/dDelete all lines that start with # (comments)
-
gg=GGo to the top (gg) and re-indent to the end of the file (=G)
-
qa (record into a) q (stop) @a (play) 10@a (play 10 times)Macros repeat the same edits for you in vim