vim Substitution

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


  • s/<pattern>/<pattern>/optional-flags
  • <pattern> is a Regex


&Keep the flags from the previous substitute.
cPrompt to confirm each substitution.
eDo not report errors.
gReplace all occurrences in the line.
iCase-insensitive matching.
ICase-sensitive matching.
nReport the number of matches, do not actually substitute.


Use set gdefault to avoid having to specify the 'g' flag on every substitute.


When gdefault is set, running :s/foo/bar on the line foo baz foo will yield bar baz bar instead of bar baz foo.

Got any vim Question?