Professional Documents
Culture Documents
Vim Tutorial Letter
Vim Tutorial Letter
Serge Y. Stroobandt
Introduction
Vim (and vi for that matter) is renowned for its notoriously steep learning
curve.
This should not scare you off. If you have not done so yet, first read “Why I Use
Vim” If you cannot bother reading it, here is my personal break down.
No, this is not an extreme case of fanboyhood. Vim is a way of life, or rather,
a means towards extreme levels of productivity with the Vim–Markdown–Pan-
doc–make input combo with any of the LaTeX/ConTeXt/XHTML/Prince/DZS-
lides back‑ends.
1
Among other things, Vim will teach you to use a keyboard professionally;
keeping your index fingers stuck to the home row. Vim allows you to edit texts
lightning fast without resorting to any computer mouse or other pointing de-
vice. Imagine the space you will gain on the folding table on your next transat-
lantic business flight! You will no longer have to use the Home , End or arrow
keys, if you chose so.
vi gang sign
My interest in Vim grew out of my annoyance with
other text editors not recognising words, parenthesis,
brackets, etc. I got fed up with manually tapping the cursor to the desired edit-
ing position. Vim is one of the few text editors which is a word processor in
the true sense of the word. It is a word processor which effectively recognises
word, bracket and parenthesis boundaries, counts words, etc.
2
Visual Cheat Sheet
For English keyboards
3
For German keyboards
Tutorial
vi/vim graphical cheat sheet tutorial
4
version 1.1
April 1st, 06
~ toggle
case ! @· #
external
filter $
play
macro % prev
ident^ & *
eol
( )
goto
match
"soft"
bol
repeat
:s
next
ident
begin
sentence
end
sentence _"soft" bol
down + next
line
`·
goto
mark 1 2 2 3 4 5 6 7 8 9 0 "hard"
bol - prev
line = auto 3
format
Q ex
modeW E WORDR
next
T· end
WORD Y U I
replace
mode O P
back
'till
yank
line
undo
line
insert
at bol
open
above
paste
before { begin
parag. } end
parag.
q· w
record
macro e r·
next
word t· end
wordy 1,3 u i
replace
char o p 'till yank undo
insert
mode
open
below
paste
after
1
[· misc
]· misc
A S
append
at eol D F·
subst
line G Hdelete
to eolJ K L
"back"
find ch : eof/
goto ln
screen
top
join
lines
help screen
bottom
ex cmd
line "· reg. 1
spec | goto
bol/
col
a s
append
d
1,3
f·
subst
char g· 6 hdeletej k find
char l ; extra
cmds
repeat
t/T/f/F '· goto
mk. bol \· used!
not
Z· ?·
4 3 3
Xquit
C 1,3 V back-
space B N M
change
to eol < >
visual
lines
prev
WORD
prev
(find)
screen
mid'l
un-
indent indent
find
(rev.)
z· 5
xextra
cmds c v
delete
char b n m· ,
change .
visual
mode
prev
word
next
(find)
set
mark
reverse
t/T/f/F
repeat
cmd /· find
moves the cursor, or defines Main command line commands ('ex'): Notes:
motion the range for an operator :w (save), :q (quit), :q! (quit w/o saving) (1) use "x before a yank/paste/del command
:e f (open file f), to use that register ('clipboard') (x=a..z,*)
command direct action command, :%s/x/y/g (replace 'x' by 'y' filewide), (e.g.: "ay$ to copy rest of line to reg 'a')
if red, it enters insert mode
:h (help in vim), :new (new file in vim),
requires a motion afterwards, (2) type in a number before any action
operator operates between cursor & to repeat it that number of times
Other important commands:
destination CTRL-R: redo (vim), (e.g.: 2p, d2w, 5i, d4j)
special functions, CTRL-F/-B: page up/down, (3) duplicate operator to act on current line
extra requires extra input CTRL-E/-Y: scroll line up/down, (dd = delete line, >> = indent line)
q· commands with a dot need
a char argument afterwards
CTRL-V: block-visual mode (vim only)
Visual mode:
(4) ZZ to save & quit, ZQ to quit w/o saving
bol = beginning of line, eol = end of line, Move around and type operator to act (5) zt: scroll cursor to top,
mk = mark, yank = copy on selected region (vim only) zb: bottom, zz: center
words: quux(foo, bar, baz); (6) gg: top of file (vim only),
gf: open file under cursor (vim only)
WORDs: quux(foo, bar, baz);
For a graphical vi/vim tutorial & more tips, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Visual Studio
Vim game
VIM Adventures
From here on
By now, you might have Vim is actually a word processor which you can easily
modify and/or extend yourself.
In other applications