Wednesday, August 26, 2009

VIM tutorial



Basic commads

i
go to insert mode (at cursor position)
I
start editing at the beginning of the line
o
go to insert mode on a new line bellow
O
go to insert mode on a new line above
A
insert at the end of the line
ESC
go to command mode
:wq
write and quite
:q
quite
:q!
quite discarding changes
:12
go to line 12
:$
go to the end of file
$
go to the end of line
^
go to the beginning of the line
0
same as above
yy
copy current line
3 yy
copy three lines
dd
cut current line
p
paste
J
join lines
/robert
search for the word "robert"
n
next occurrence
?robert
search for "robert" in reverse order
u
undo
.
repeat last modification operation
cw
change word
x
delete backwards
w
skip to next word
5w
skip five words
b
skip to the previous word
)
skip to next sentence
(
skip to previous sentence
dw
delete word at the right
db
delete word at left
das
delete current sentence