vimtutor.pdf

(109 KB) Pobierz
VIM
tutor
Revision: February 1, 2011
4
Deletion commands
x
dw
d#w
d$
dd
Delete
Delete
Delete
Delete
Delete
char. under cursor
word
# words
to the end of line
line (paste with
p)
8
Setup
:set [no]number
Enable/disable line numbering
By Anders Damsgaard Christensen,
anders.damsgaard@geo.au.dk.
This document is a summary of basic
VIM
commands, presented in
the
VIM
tutorial,
vimtutor,
version 1.7.
9
Help
:help [cmd]
CTRL-W CTRL-W
Display general help, or
display help on
cmd
Switch between windows
1
Exiting
VIM
& file-/ system control
:w
:w filename
:q
:wq
or
:x
:q!
:!cmd
:r filename
Write file
Save file as
filename
Exit
Save and exit
Exit, discard changes
Execute external command
cmd
in
external shell
Insert contents of file named
filename
at cursor
5
Change command
ce
c$
Delete from cursor until end of word, goto
insert mode
Delete from cursor until end of line, goto
insert mode
Undo
u
U
CTRL—r
Undo single action
Undo all changes on a line
Redo
Search forward for string, browse
through matches forward with
n,
backwards with
N
Search forward for string, ignore
case
Search backwards for a string
Find
matching
paranthesis
((...),
[...]
or
{...})
Substitute next match of old
string with new string
Substitute all matches in line
range #–# of old string with
new string
Substitute all matches of old
string with new string
Substitute next match of old
string with new string, but ask
at each occurrence.
10
LaTeX-suite
A
Run L TEX-compiler
Open document viewer
Choose template
Insert PS figure (i mode)
Next placeholder (i mode)
Insert environment
Insert command
Font mode (e.g. Emph: FEM)
Section insertion (e.g. Section: SSE,
Subsec: SSS)
6
2
Modes
i
a
A
r
R
v
CTRL—g
Insert before the cursor
Insert after the cursor
Append at the end of line
Replace char. under cursor
Replace mode
Visual selection (y: copy,
p:
paste)
Display file status
7
Search
/string
/string\c
?string
%
:s/old/new
:#,#s/old/new
:s/old/new/g
:s/old/new/gc
\ll
\lv
:TTemplate
EFI
CTRL—j
F5
F7
F
S
3
0
$
gg
G
:#
e
b
o
O
Cursor movement
Beginning of line
End of line
Beginning of file
End of file
Go to line no. #
Go to end of next word
Go to beginning of previous word
Open a line below the cursor, goto insert mode
Open a line above the cursor, goto insert mode
1
Zgłoś jeśli naruszono regulamin