-
-
Notifications
You must be signed in to change notification settings - Fork 2
4.5. Substitution
shinokada edited this page Oct 6, 2014
·
1 revision
# first match on the current line
:s/search/replace/
# all matches on the current line
:s/search/replace/g
# every match in the file
:%s/search/replace/g # % is the same as 1,$
# search and replace by line numbers
:100,200s/search/replace/g
# case insensitive with i
:%s/search/replace/gi
# confirm each match with c
:%s/search/replace/gic
y Yes; make this change.
n No; skip this match.
a All; make this change and all remaining ones without
further confirmation.
q Quit; don't make any more changes.
l Last; make this change and then quit.
CTRL-E Scroll the text one line up.
CTRL-Y Scroll the text one line down.
# substitute with the content of register a
:%s/search/<C-r>a/g
# open multiple files
vim *.js
# list the buffers
:ls
:59,$s/$/\r # add line breaks
Important: The Tables of Content are generated. Any change will be overridden on the next update.
For more information: GitHub Wikifier