PracticalVim Tip87 - yszheda/wiki GitHub Wiki
- `g` flag makes the substitute command act globally, causing it to change all matches within a line rather than just changing the first one.
- `n` flag suppresses the usual substitute behavior, causing the command to report the number of occurrences that would be affected if we ran the substitute command.
- `e` flag silence these errors.
- `&` flag simply tells Vim to reuse the same flags from the previous substitute command.
| Symbol | Represents | | `\r` | Insert a carriage return | | `\t` | Insert a tab character | | `\\` | Insert a single backslash | | `\1` | Insert the first submatch | | `\2` | Insert the second submatch (and so on, up to `\9`) | | `\0` | Insert the entire matched pattern | | `&` | Insert the entire matched pattern | | `~` | Use {string} from the previous invocation of `:substitute` | | `\={Vim script}` | Evaluate {Vim script} expression; use result as replacement {string} |