|
My cheat sheet for vi short cuts!
IM: insert mode
CM: command mode
VM: visual mode
Start IM (CM):
--------------
i insert before cursor
o/O open new line after/before current line
R replace characters as you write
Exit/save (CM):
---------------
:q exit without save.
:q! exit ignoring changes.
:w save text.
:wq save and exit.
:x save and exit.
Move cursor (CM):
-----------------
w/W move to next word/blank.
b/B move to previous word/blank.
(/) move to next/previous sentence.
{/} move to next/previous paragraph.
0/$ move to beginning/end of line.
H/M/L move to top/middle/bottom of screen.
Delete (CM):
------------
x/X delete/backspace
D delete to the endo of the line
dw delete workd
dd delete line
Yank (CM):
----------
3yw yank 3 words
y$ yank to the end of line
yy yank line
3Y yank 3 lines
Paste (CM):
-----------
p/P paste after/before cursor
Change (CM):
------------
3cw change 3 words
C change to the endo of line
cc change line
Undo/Redo (CM):
---------------
u undo last change
Ctrl + R redo last change
Search (CM):
------------
/ search forwards
? search backwards
n next instance
N previous instance
Search and replace (CM):
------------------------
:%s/foo/bar/g Search for foo, replace for bar in all lines.
:%s/<foo\>/bar/g Search for exact whole word foo
Block-wise edit (multiple lines) (VM):
--------------------------------------
- Ctrl + v Enter block-wise visual mode
- Move cursor up/down the number of lines to edit
- Shift + i Enter insert mode
- Write down text
- Escape
|