Cheatsheet Pages / Vim Cheatsheet
How to find and replace on the current line in Vim — :s with g and c flags
One line needs a substitution — everywhere on that line (g), or with a confirmation prompt for each hit (c).
Almost every entry was run headless in Vim 9.1 and the resulting file checked; the few entries a tiny build cannot run (system clipboard, persistent undo, the sudo save) were verified against Vim's own documentation instead.
:s/foo/bar/ " replace the FIRST foo on this line
:s/foo/bar/g " g = global: every foo on the line
:s/foo/bar/gc " c = confirm: Vim asks y/n for each match before touching it
