Vim Hotkey cheetsheet
Edit Commands
i insert before the word
a insert after the word
I insert at the beginning of the line
A insert at the end of the line
o open a new line to edit
O open a line above
Insert
10 i * 【ESC】 insert 10 *
25 a xx 【ESC】 insert 25 xx
J Join two lines
Move
4l move 4 characters to the right
0 move to the beginning of the line
^ move to the beginning of the line
$ move to the end of the line
2w move forward two words
3W move forward three words (count only spaces)
2b move backward two words
5B move backward five words (count only spaces)
e move to the end of the word
Move within the screen
H move to the top of the screen
M move to the middle of the screen
L move to the bottom of the screen
nH move to the nth line of the current screen (upward)
nL move to the nth line of the current screen (downward)
Move between sentences, paragraphs and sections
( move to the beginning of the sentence
) move to the end of the sentence (beginning of the next sentence)
{ move to the beginning of the paragraph
} move to the end of the paragraph
[[ move to the beginning of the section
]] move to the end of the section
【Ctrl】+F scroll down one screen
【Ctrl】+B scroll up one screen
【Ctrl】+D scroll down half screen
【Ctrl】+U scroll up half screen
Search
/ XX search XX
/【Enter】 search downward
?【Enter】 search upward
f XX search within the line (forward)
F XX search within the line (backward)
R replace mode
s delete and insert the current word
S delete the whole line and insert at the beginning
~ change case
p put
2p put twice (paste)
xp transpose two characters
d delete
2dd delete two lines downward
d3w delete three words forward
d3W
d2b
d2B
y yank
yy copy the whole line
y2w copy two words forward
y2b
c change
cw change the whole word
c2w change two words forward
c3B
r replace
5rT replace next 5 characters with T
【Enter】 move to the first character of the next line
+
- move to the first character of the previous line
^ move to the first non-space character of the line
n| move to the nth column of the line
gg move to the top of the document
G move to the bottom of the document
10G move to line 10
【Ctrl】+G show line status
zz save and exit
:e! clear all editing results
:q! exit without saving
. repeat the last command
u undo
【Ctrl】+R redo
z 【Enter】 put the line at the cursor to the top of the screen
z . put the line at the cursor to the middle of the screen
z - put the line at the cursor to the bottom of the screen
Leave a message