Since I started to use my yiiCheatSheet quite often I think it won't be bad to create a vimCheatSheet
But this will be for me mostly - i don't want to waste space with hjkl.. ;)

Folding

  • link
  • fold: mark area and then zf or zfj2 without marking
  • fold brackets: zfa}
  • fold jumping: zj zk
  • fold open: single: zo all:zO

Marks

  • link
  • mark mx ?
    x is a letter
    capital x means global mark
  • jump `x or 'x
  • list :marks

Yank Buffer

  • link
  • "xd$?
    x is a letter, 1 is last, 1-9 LIFO
  • "xdp

Makro

  • qa .. .. q
  • @a

Regex

  • link
  • Grouping with \( and \)

Misc

  • ZZ - quicksave
  • :x - exit and save when changes
  • :s/bla/blub/gc - replaces bla with blub and asks for confirmation
  • :g/hier bla/s/bla/blub/g - replaces bla with blub on all lines containing "hier bla"
  • :ab code some text - will create an abbrevation for "some text" and replace code always with it (in insert mode and also in : mode) :unab removes, :ab lists
  • :map x sequence - maps the sequence to key x (g,K,q)
  • @x will execute the commands inside the named buffer x

ex editor

  • :1 line 1
  • :. current line (no number defaults to current line also)
  • :$ last line
  • :% every line (1,$)
  • :/pattern/ next line containing a pattern
  • :1,3 line 1-3
  • :100,+5 line 100-current line+5
  • :100;+5 line 100-105
  • :1,.+20 line 1-current+20
  • :1,3# temporary display line 1-3
  • :1,3y yank line 1-3
  • :g/pattern/# temp displays all patterns
  • :1,3g/pattern/# temp displays all patterns between line 1-3
  • :r file - read a file and insert it at the current cursor

Tabs - useful?

  • link
  • open:
    • :tabnew filename
    • vim -p filenames
    • :tabf find filename in current path
  • browse:
    • gt and gT
    • :tabn :tabp
    • :tabfirst :tablast
  • close: :wqa or :qa