VERY POWERFUL editor. I try to track down hints and tips here.

  • remove empty lines: :g/^$/ d
  • search: /text finds text
  • find next: n
  • find prev: N
  • insert characters from line aboove: Ctrl-Y
  • delete everything between "": di"
  • open in a tab: :tabe
  • :set fileformat=unix
  • convert many files from something to utf-8:
    • vim *.java
    • :set fenc=utf-8
    • :wn
  • pipe shell output to buffer: :r! (found here)
  • substitute something with carriage returns: s/<something>/CtrlVCtrlM/, where CtrlVCtrlM are two control characters in a row: Ctrl-V and Ctrl-M. link

My .vimrc, which borrows heavily from a package by Andrei Zmievski (tar.gz).

Cheat sheet