HMC Homepage      CS Home

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

Action

Command

invoke vim vim filename
save file :w
exit vim :q
command line mode Esc
undo u
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 line up arrow or k
down one line down arrow or j
right one character right arrow or l
left one character left arrow or h
next word (until first character of next word) w
next word (until end of current word) e
previous word b
beginning of line 0
end of line $
page forward ^d
page backward ^u
Delete Commands
delete current character x
delete current character and replace it with one character r [character]
to end of line d$
entire current line dd
paste what was just deleted p
delete to end of word and put into insert mode ce
delete to end of line and put into insert mode c$


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.''

HMC Computer Science Department
Olin Science Center
301 E. Twelfth Street Claremont, CA 91711-5980 USA
PH : (909) 621-8225 FX : (909) 621-8465
Info Email: CS Staff or Admission Office
Last Modified Tuesday, 20-Nov-2006 16:56:54 PDT