My vi cheatsheet

Submitted by kitt on Tue, 2005-09-13 17:26.

There are plenty of vi cheatsheets, and helper files (:help in vi, for example). However, they list all the commands. I want specifically the commands I use on a regular basis. So, here's my cheatsheet (YAVICS).

:w             write file
:q             quit
:!q            quit without saving

:e [filename]  open file [filename] for editing

dd             delete line
3dd            delete three lines, replace 3 with any number
yy             yank a line that was just deleted
3yy            yank 3 of those lines that you just deleted with 3dd

p              paste


                Help
               Back to normal mode
     V              Visual mode
     i              Insert mode
     :              Command-line commands
     :set tw=72     Set text width to 72
               Insert (paste) mode
     :r! date -R    Insert RFC-822 date
     qa             Record keystrokes into register a
     q              Stop keystroke recording
     @a             Execute keystrokes from register a
     :edit foo.txt  Edit another file by loading foo.txt
     :wnext         Write current file and edit next file