Vim Cheat Sheets on a Mug

I’ve been thinking about some promotional material for the company I work for. What inspired me was seeing a vi coffee mug… Unfortunately only available in the US. I’ve been endeavouring to wean myself off textmate and the like so thought this was a brilliant idea. But with limited space, what essential commands should go on a vim cheat sheet? What other cheat sheets would you like to see in this format?



:e filename Open a new file.
:w filename Save changes to a file.
:q Quit Vim.
:q! Exit Vim without saving changes.
:wq Write the file and exit. :x Exits without writing the file.
j Move the cursor up one line.
k Down one line.
l Right one character.
h Left one character.
e To the end of a word.
E To the end of a whitespace-delimited word.
b To the beginning of a word.
B To the beginning of a whitespace-delimited word.
0 To the beginning of a line.
^ To the first non-whitespace character of a line.
$ To the end of a line.
H To the first line of the screen.
M To the middle line of the screen.
L To the the last line of the screen.
:n Jump to line number n.
i Insert before cursor.
I Insert to the start of the current line.
a Append after cursor.
A Append to the end of the current line.
o Open a new line below and insert.
O Open a new line above and insert.
C Change the rest of the current line.
r Overwrite one character.
R Enter insert mode but replace characters.
x Delete characters under the cursor.
X Delete characters before the cursor.
dd Delete the current line.
v Start highlighting characters.
V Start highlighting lines.
~ Change the case of characters.
> (V) Shift right.
< (V) Shift left.
c (V) Change the highlighted text.
y (V) Yank the highlighted text.
d (V) Delete the highlighted text.
yy Yank the current line.
p Put characters after the cursor.
P Put characters before the cursor.
u Undo the last action.
U Undo all the latest changes.
Ctrl + r Redo.
/pattern Search the file for pattern.
n Scan for next search match
N Scan for next search match opposite direction.
:%s/foo/bar/a Substitute foo with bar.

2 comments to Vim Cheat Sheets on a Mug

  • Chris

    Trouble with vi cheat sheets (or the great thing) is that everyone has their own favourite commands. Some offen use “xp” to transpose two characters, etc. I would delete the hjkl (the arrow keys work well except in emergencies); the “I” (same as “^i” – or “0i”); also H,M,L; and I never seem to use “P” because a cursor move and a “p” works just as well. I like :q! rather than :x , and use :w! sometimes to write read only system files (so long as I’m root…)

    I use these a lot:
    f Move cursor to next character
    t Move cursor to just before next character
    dw delete word
    cw change word
    (use the above with a “count” and use “W” instead of “w” sometimes).
    “J” for joining lines.
    The “.” command is very handy indeed for repetative work – adding the same text to the start/end of most (but not all) lines in the file, etc.

    Finally I cut my teeth on vi and never heard of the vim “v” and “V” commands! No more counting characters or lines for me!

  • Coffee mugs are a great promotional item (much better than pens, or random junk with a logo on it).

    But I think that this is a bit too much information to print on a mug.

    If you had nicely printed 6″x8″ cards (on thick glossy card stock), then they would get pinned to my cubicle wall.

    Also, it’s much cheaper to post cards to people that want them.

    Save the coffee cup for your company logo, a URL, and a snappy slogan that says what you do.

    Cheers,
    Stu.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">