Modes & Files
vi fooEdit file foo
ESCCommand mode
control-[Same as ESC
:w barSave as bar
ZZ or :xSave & Exit
:r fooRead & insert file foo
ZQ or :q!Exit without save
iInsert before cursor
IInsert before line
aAppend after cursor
AAppend after line
oAdd new line after
OAdd new line before
:r fooRead & insert file foo
pPaste after line (after dd, yy)
PPaste before line (after dd, yy)
CRewrite to end of line
h or ←Cursor left
j or ↓Cursor down
k or ↑Cursor up
l or →Cursor right
wNext word
WNext spaced word
bStart of word
BStart of spaced word
eEnd of word
EEnd of spaced word
(Previous sentence
)Next sentence
}Previous paragraph
{Next paragraph
0Beginning of line
$End of line
1G or ggStart of file
GEnd of file
:5 or 5GLine 5 of file
fpNext 'p' in line
FpBack to 'p' in line
tpNext before 'p' in line
TpBack to after 'p' in line
HTop of screen
MMiddle of screen
LBottom of screen
%Matching bracket
xDelete current (right) character
XDelete previous (left) character
DDelete rest of line
dd or :dDelete (cut) current line
2ddDelete next two lines
dwDelete next word
2dwDelete next two words
:4,10dDelete lines 4 to 10
dGDelete rest of file
/fooFind next foo
?fooFind last foo
nFind next
NFind last
*Find next of this word
#Find last of this word
/lkajdfGibberish to clear find hilight
rReplace one character
RReplace characters
:s/foo/barReplace foo with bar
:s/foo/bar/gReplace every bar
:s/foo/bar/cConfirm replaces
:1,$s/foo/bar/gcReplace all with confirm
.Repeat last one time
2.Repeat last two times
uUndo last change
yyCopy (yank) line
JJoin lines
>>Indent current line
5>>Indent next 5 lines
<<Unindent current line
5<<Unindent next 5 line
>}Indent paragraph
<}Unindent paragraph
:set [no]nuLine numbers
:set [no]listShow tabs and returns
:set [no]spellSpelling
:set pasteGet ready to mouse paste
:set [no]aiAuto indent