Daily Archives Thursday, May 2007

Vim: Search and Replace, Insert new line

Vim has some really useful commands, especially search and replace ones. Unfortunately I'm always forgetting the finer details of how to use them so here's an example:
PLAIN TEXT
CODE:

:%s/$/\rthis is a new line

To break down whats happening above:

: switches Vim into command mode
% means we're going to apply this command to every line in our [...]