s/<pattern>/<pattern>/optional-flags<pattern> is a Regex| Flag | Meaning | 
|---|---|
| & | Keep the flags from the previous substitute. | 
| c | Prompt to confirm each substitution. | 
| e | Do not report errors. | 
| g | Replace all occurrences in the line. | 
| i | Case-insensitive matching. | 
| I | Case-sensitive matching. | 
| n | Report 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.