Saturday, January 2, 2010

vi useful shortcut keys

dw delete a word
d$ delete to end of line
D delete to end of line
w move to next word (start)
e move to next word (end)
5w move 5 words and place cursor at first
5e move 4 words and place cursor at end
0 move to start of line
d5w delete 5 words
5dd delete 5 lines
Ctrl+R redo
ce change to end of word
c5e change 5 words
c$ change to end of line
C change to end of line
ctrl+G location in the file
gg move to start of file
% find matching ()[]
:! execute external command
v start select (virtual mode)
V start select whole line (virtual mode)
ctrl+v select rectangle
:w f write selection to file f
Y or yy copy current line
y copy the selection
d delete the selection
:r f insert text from f to this file
:r !ls put the ls output to current line
o open line below cursor
y5w yank 5 words
:set is set incrimental search
:help help
: ctrl+D possible completions
fa move to first 'a' character
ta move to before first 'a' character
dfa delete until the first 'a' character
cc clear current line and enter insert mode
S clear current line and enter insert mode
ma bookmark 'a' for the position
'a go to bookmark 'a'
'. go to last modification
HML jump to top/middle/last line of the screen
J join current lines
~ toggle case
* find the word under cursor.
. repeat last changing.
--jump-target position target line on line num of screen.

No comments:

Post a Comment