Title here
Summary here
| Flag | Does |
|---|---|
g | every match on the line, not just the first |
c | confirm each one |
i | ignore case for this substitute |
n | count matches without changing anything |
:%s/pattern//gn is a quick “how many of these are there?” — it reports a count and changes nothing.
With c, each match offers y (yes), n (no), a (all the rest), q (quit), l (this one, then stop).
:%s/"\(\w\+\)":/"\U\1\E":/g\(...\) captures, \1 … \9 reuse it\U upper-cases everything after it, \L lower-cases, \E ends the change& in the replacement means “the whole match”Prefix the replacement with \= and Vim evaluates it as an expression:
:%s/\d\+/\=submatch(0)*2/g " double every numberThe / is not special — any character works. When the pattern contains slashes, use something else:
:%s#/usr/local#/opt#g:s with no arguments repeats the last substitute on the current line. :%s//new/g reuses the last search pattern, so you can search first, confirm the matches highlight what you expect, then substitute.