Title here
Summary here
The part before s is the range:
| Range | Means |
|---|---|
:s | this line only |
:%s | the whole file |
:10,20s | lines 10 to 20 |
:.,+5s | this line and the next five |
:.,$s | here to the end |
:'<,'>s | the visual selection |
:'a,'bs | between marks a and b |
:g/pat/s | every line matching pat |
:%s/\<total\>/subtotal/g\< and \> are word boundaries. Without them, total also matches inside subtotal and totals — and if the replacement contains the original, the substitute can start matching its own output.
Other useful pieces:
| Pattern | Matches |
|---|---|
\d\+ | one or more digits |
\s* | any run of whitespace |
^ / $ | start / end of line |
.\{-} | non-greedy “as few as possible” |
\(...\) | a capture group |
\c anywhere in the pattern forces case-insensitive; \C forces case-sensitive — regardless of your ignorecase setting.