
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

command mode
you can navigate the file and use the commands on this sheet
insert mode
you insert text into the file and can move around (using the arrows) in the file if you are using vim. You exit insert mode by pressing the ESC key.
special command mode
Allows you to enter special commands. While in command mode, press :
i insert before cursor o lower-case oh opens a new line (below) O upper-case oh opens a new line (above) a append (insert after cursor) A append at end of line
:w write contents to disk :wq write contents and quit ZZ write contents and quit :q quit :q! quit and don’t save changes
/foo search forward for “foo” ?foo search backwards for “foo” n repeat last search
x delete current character 10x delete 10 characters dd delete current line 6dd delete 6 lines d0 delete to beginning of line d$ delete to end of line dw delete word 3dw delete 3 words
yy yank (copy) 5yy yank 5 lines
p lower-case pee pastes after cursor P upper-case pee pastes before cursor
"a7dw delete 7 words and place in buffer a "b5dd delete 5 lines and place in buffer b "ap paste contents of buffer a "bp paste contents of buffer b
↑ move up one line 5 ↑ move up 5 lines ↓ move down 1 line 6 ↓ move down 6 lines 1G go to line 1 15G go to line 15 G go to last line H go to top of screen (high) L go to bottom of screen (low) w go to next word 7w move over 7 words b back one word 0 go to beginning of line $ go to end of line
:r foo read file foo into this file after cursor :! command execute the specified unix command and return to vi :r! command execute the specified unix command and read the results into this file after the cursor :10,20d delete lines 10- :1,$s/alpha/beta/g from the first line to the last line, change all occurrences of alpha to beta. :5,10> indent lines 5 through 10 :20,30< de-indent lines 10 through 20
u undo
. repeat last command J join two lines 5>> indent 5 lines 1 tab 2<< de-indent 2 lines 1 tab
% with cursor on a brace, indent bracketed block of lines <% de-indent bracketed block of lines