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.

Also try my .vimrc file or visit http://del.icio.us/ryanwick/vim

  • To jump to a specific byte location in a file, type :go #####
  • To jump to a specific line, type :####
  • To jump to the end of a line, use $
  • To jump to the beginning of a line, use |
  • For find/replace with backreference: :%s/\(\d\d\d\d\)\./\1<\/date>./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