VIM editor common commands


Turn pages

command effect
Ctrl + f The screen moves down one page
Ctrl + b Move up one page
Ctrl + d Move half page down
Ctrl + u Move half page up
G Move to last page of document
gg Move to the first line of the document

Insert and replace

command effect
i Insert from current cursor
I Insert from the first non space on the line where the current cursor is located
a Insert from the next character under the current cursor
A Insert from the last character in the line of the cursor
o Insert a new line under the cursor
O Insert a new line on the cursor
r Replace the text at the cursor once
R Replace untilESCuntil
ESC Exit edit mode

Find and replace

command effect
/word lookup
n next
N the previous
:n1,n2s/word1/word2/g From line N1 to line N2, replace word1 with word2
:1,$s/word1/word2/g Replace from first line to last line

Copy and paste

command effect
yy Copy cursor line
p Paste the data to the next line under the cursor
P Paste the data onto a line above the cursor
u Restore the previous action
Ctrl + r Repeat the previous action

This work adoptsCC agreement, reprint must indicate the author and the link to this article