vi / vim graphical cheat sheet _ ^ $

advertisement
UK version 1.0
October 2nd, 14
vi / vim graphical cheat sheet
Esc
normal
mode
reg. 1
not
not
¬ used!
£ used!
"· spec
filter
! external
$
`·
goto
mark
&
%
^
(
*
)
7
5
6
9
4
8
3
1 2 2
0
Q
R
Y
P
I
O
U
W E
T·
1,3
q·
r·
y
w
e
t·
p
o
u
i
D
A
S
F·
G
H
J
K
L
:
1,3
g· 6 h
;
a
s
k
j
d
f·
l
3
4
3
|
C 1,3 V
>
Z·
<
X
B
N
M
5
\·
c
z·
n
m· ,
x
v
.
b
motion
repeat
:s
begin
sentence
next
ident
_
+ 3
=
{
}
1
[·
]·
@· ~
'·
#
?·
/·
end
sentence
"soft" bol
down
"hard"
bol
next
line
auto
format
prev
line
ex
mode
next
WORD
end
WORD
replace
mode
back
'till
yank
line
undo
line
insert
at bol
open
above
paste
before
begin
parag.
end
parag.
record
macro
next
word
end
word
replace
char
'till
yank
undo
insert
mode
open
below
paste
after
misc
misc
append
at eol
subst
line
delete
to eol
"back"
find ch
append
subst
char
delete
find
char
eof/
goto ln
screen
top
join
lines
help
screen
bottom
extra
cmds
bol/
goto col
quit
backspace
change
to eol
visual
lines
prev
WORD
prev
(find)
screen
mid'l
unindent
indent
not
used!
extra
cmds
delete
char
change
visual
mode
prev
word
next
(find)
set
mark
reverse
t/T/f/F
repeat
cmd
moves the cursor, or defines
the range for an operator
command direct action command,
if red, it enters insert mode
requires a motion afterwards,
operator operates between cursor &
destination
special functions,
extra
requires extra input
commands with a dot need
a char argument afterwards
bol = beginning of line, eol = end of line,
mk = mark, yank = copy
words: quux(foo, bar, baz);
WORDs: quux(foo, bar, baz);
q·
"soft"
bol
goto
match
eol
Main command line commands ('ex'):
:w (save), :q (quit), :q! (quit w/o saving)
:e f (open file f),
:%s/x/y/g (replace 'x' by 'y' filewide),
:h (help in vim), :new (new file in vim),
Other important commands:
CTRL-R: redo (vim),
CTRL-F/-B: page up/down,
CTRL-E/-Y: scroll line up/down,
CTRL-V: block-visual mode (vim only)
Visual mode:
Move around and type operator to act
on selected region (vim only)
ex cmd
line
repeat
t/T/f/F
play
macro
toggle
case
goto
mk. bol
prev
ident
find
(rev.)
find
Notes:
(1) use "x before a yank/paste/del command
to use that register ('clipboard') (x=a..z,*)
(e.g.: "ay$ to copy rest of line to reg 'a')
(2) type in a number before any action
to repeat it that number of times
(e.g.: 2p, d2w, 5i, d4j)
(3) duplicate operator to act on current line
(dd = delete line, >> = indent line)
(4) ZZ to save & quit, ZQ to quit w/o saving
(5) zt: scroll cursor to top,
zb: bottom, zz: center
(6) gg: top of file (vim only),
gf: open file under cursor (vim only)
For a graphical vi/vim tutorial & more tips, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Visual Studio
Download