Vim Tips

This page has an assorted list of tips and tricks that were either hard to find or very useful. Most of these I’ve picked up from various articles or sites, so I figured it wouldn’t hurt to contribute to the available material.

For find/replace with backreference: :%s/\(\d\d\d\d\)\./\1./g
Can also use & to reference entire pattern match
When using modifiers like + and ?, put a slash in front of them
When matching newlines, use \n for the search, \r for the substitution

To redo the last command, type .

Edit multiple files using buffers. Can use :b# to change to a new one, like :b3