vim tips and tricks

registers

When you copy and cut stuff, it gets saved to registers. You can pull stuff from those registers at a later time.

 :reg     - show named registers and what's in them
 "5p      - paste what's in register "5

You can also record a whole series of edits to a register, and then apply them over and over.

 qk       - records edits into register k 
            (q again to stop recording)
 @k       - execute recorded edits (macro)
 @@       - repeat last one
 5@@      - repeat 5 times

 "kp      - print macro k 
            (e.g., to edit or add to .vimrc)
 "kd      - replace register k with what cursor is on