PracticalVim Tip90 - yszheda/wiki GitHub Wiki
- Leaving the search field of the substitute command blank instructs Vim to reuse the most recent search pattern.
- → Decouple composing a pattern and devising a suitable replacement string.
equivalent to:
Example: join every line of a file by replacing newlines with commas:
- Patterns are saved in Vim’s search history, while substitute commands are saved in the history of Ex commands
- → Decoupling the search and replacement tasks causes the two pieces of information to be placed in separate silos, which could cause difficulty if you want to reuse an old substitute command later.
- Solution: pressing `/` at the command line pastes the contents of the last search register in place.