Wednesday, May 20, 2009

Table made available by:

HMC Computer Science Department

Copyright (c) HMC Computer Science Department. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License.''

A List of the Key Commands in Vim

The ^ character denotes holding control then hitting the next key.

Placing a number immediately before any command will repeat that command. For example, typing 4dd will delete the current line and the next 3.

Vim Commands



invoke vimvim filename
save file:w
exit vim:q
command line modeEsc
Search and Replace
search forward / [string]
search backward? [string]
find and replace once:s/[string to be found]/[thing to replace it]
find and replace on line:s/[string]/[string]/g
find and replace globally:%s/[string]/[string]/g
Movement Commands
up one lineup arrow or k
down one linedown arrow or j
right one characterright arrow or l
left one characterleft arrow or h
next word (until first character of next word)w
next word (until end of current word)e
previous wordb
beginning of line0
end of line$
page forward^d
page backward^u
Delete Commands
delete current characterx
delete current character and replace it with one characterr [character]
to end of lined$
entire current linedd
paste what was just deletedp
delete to end of word and put into insert modece
delete to end of line and put into insert modec$

No comments: