vi / vim graphical cheat sheet
Esc normal mode
~ `.
toggle case goto mark
@ # $. ( ) ! %. ^ & * 1 2 3 4. 5. 6 7 8 9 0 Q. W E R T Y U I O P. q. w e r. t. y u o p i : A. S D F G H J K L a s g. ; j d f. h k l > Z. X C V B N M < z. x c v n m , . b
motion
external filter
play macro
prev ident
append
subst char
delete
1,3
q.
"soft" bol
repeat :s
next WORD
end WORD
replace mode
back 'till
yank line
record macro
next word
end word
replace char
'till
yank
subst line
delete to eol
append
subst char
delete
1,3
extra4 quit
backspace
change to eol
extra5 cmds
delete char
change
moves the cursor, or defines the range for an operator
1,3
begin sentence
end sentence "hard" bol
ex mode
append at eol
next ident
extra6 cmds
fwd to char
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 res := base + v.offset; words: WORDs: res := base + v.offset; command
goto match
eol
1,3
"back" fwd
eof/ goto ln
fwd to char
extra6 cmds
undo line
insert at bol
open above
undo
insert mode
open below
screen top
join lines
help
_. -
paste before paste 1 after
screen bottom
visual lines
prev WORD
prev (find)
screen mid'l
un- 3 indent
indent
3
visual mode
prev word
next (find)
set mark
reverse t/T/f/F
repeat cmd
repeat t/T/f/F
begin parag. misc
". '.
next line
auto 3 format
prev line
{. [.
ex cmd line
?. /.
+. =
"soft" bol down
}. ].
reg. 1 spec goto mk. bol
end parag. misc
|. \.
bol/ goto col not used
find rev. find
Main command line commands ('ex'):
Notes:
: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),
(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')
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)
(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)
Based on SVG version at http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html