2/13/2013 - 11:52 AM

vi shortcuts

vi shortcuts


i = Enter insert mode
o = Insert after current line (enter insert mode)
O = Insert before current line (enter insert mode)
a = Append after current character (enter insert mode)
A = Append at end of line (enter inset mode)

u = undo

dd = Remove current line (add <int> before for multiple)
dk = Remove previous line (add <int> before for multiple)
di<character> = Remove characters between given character 
dw = Remove current word
cw = Remove current word and enter insert mode
ci<character> = Remove characters between given character, enter insert mode
d$ = Remove rest of line
yy = Copy current line
p = Paste after current line
<< = Shift line left
>> = Shift line right

dG = Remove rest of file
D = Remove rest of line

xp = Transpose current and next character
~ = convert case if character

+ = Start of next line
Ctrl+f = Forward one page
Ctrl+b = Back one page
<int>G = Goto specified line in file
H = Goto first line in window
L = Goto last line in window

/<term> = search forward for term (n to repeat forward, N to repeat back)
?<term> = search backwards for term (n to repeat back, N to repeat forward)
(add \c to make case insensitive)

:<int> = Goto specified line in file
:$ = goto end of file
:!<cmd> = Run shell command

  - Replace all occurances of <search> with <replace>

ZZ = Save and quit


Esc = Leave insert mode / enter command mode