Show Menu
Cheatography

Vimtutor Cheat Sheet by

the summary of vimtutor

Lesson 1

h j  k  l 
cursor move either the arrow or
hjkl
keys
vim FILENAME <ENTER>
To start Vim from shell
<ESC> :q! <ENTER>
<ESC> :wq <ENTER>
to trash all changes.
to save the changes.
x
To delete the character at the cursor
i
INSERT MODE before the cursor
A
INSERT MODE after the line

Lesson 2

dw
del from the cursor to the next word
d$
del from the cursor to the end of line
dd
del whole line
2w
repeat the motion with a number
operator [number] motion 
operator
[number]
motion
where:
- is what to do
d

- [optional] repeat motion
2

- move to the text to operate
2w
0
move to the start of the line
u
U
Ctrl -R
To undo previus action
To undo all the actions on a line
To undo the undo's

Lesson 3

p
put the deleted text AFTER the cursor
r [char]
replace the character under the cursor
c
change from the cursor where the motion take you. Eg.
c$ ce cw
c [number] motion
it is the format for changing
 

Lesson 4

CTRL-G
G
number G
gg
show your location and the file status
move to the end of the file
move to that line number
go to the first line
/foo <ENTER>
?foo <ENTER>
n
N
CTRL-O
CTRL-I
search
foo
FORWARD of the
phrase

search
foo
BACKWARD of the
phrase

find the next occurrence
find the previous occurrence
Takes you to the PREVIOUS position
Takes you to the NEWER position
%
type it on
(
,
)
,
[
,
]
,
{
or
}
and goes to its match
:s/old/new
:s/old/new/g
:#,#s/old/new/g
:%s/old/new/g
:%s/old/new/gc
substitude first
old
for
new

substitude all
old
for
ǹew
in the line
substitude all matchs between the lines
#

substitude all matchs in the file
to check each time add
c

Lesson 5

:!command
execute an external
command

Eg. win:
!dir
or in Unix:
!ls
:w FILENAME
write the current VIM file to the disk with the name
FILENAME
v motion :w FILENAME
saves visually selected lines in the file
FILENAME
.
:r FILENAME
retrives disk file FILENAME and puts belong cursor position
:r !command
reads the output
command
and puts belong the cursor Eg. win:
!dir
or in Unix:
!ls
 

Lesson 6

o


O

insert a line BELOW the cursor and start
INSERT MODE
.
Open a line ABOVE the cursor
a

A

insert text after the cursor
insert text after the end of the line
e
move to the end of a word
y
copy the text and
p
paste it
R
Enter in
REPLACE MODE
until
<ES­C>
is pressed
:set foo

ic
or
ignorecase 
is
or
insearch 
hls
or
hlsearch
sets the option
foo

Eg.
:set ic

ignore upper/­lower case when seaching
show partial matches for a search phrase
highlight all matching phrases.
:set nofoo
preset
no
to switch an option off
Eg.
:set noic

Lesson 7

<HELP KEY> 
<F1>
:help <ENTER>
Vim has a compre­hensive on-line help system. To get started, try one of these three
:help cmd
to find help on
cmd
CTRL-W CTRL-W
to jump to another window
:q
to close help window
~/.vmrc
a startup script to keep your preferred settings.
:cmd CTRL-d 
:cmd <TAB>
to see possible comple­tions,
to autoco­mplete
       
 

Comments

Thank you for making this cheatsheet, I was about to create it and you spared me some time.

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          VI Editor Cheat Sheet
          Vim NERDTree Cheat Sheet
          Juanjux's Vim Cheatsheet Cheat Sheet

          More Cheat Sheets by gamejia90

          Basic Bash Keyboard Shortcuts
          Full Bash Shortcuts Cheat Sheet