vim is not a long time to use, but it is now inseparable from the familiar vim editing mode. Vim 's learning curve is very steep, at the beginning of learning, the face of a lot of operational commands to remember, often deterred.
In fact, just remember some of the commonly used commands, coupled with the use of Vim in the work of editing, will soon be handy.
# # #光标移动 (Cursor movement)
Command |
function (explanation) |
h,j,k,l |
h Indicates to the left, j indicating downward, to the k right, to the l upper |
Ctrl +f |
Previous page |
Ctrl +b |
Next page |
w , e , W ,E |
Jumps to the back of the word, lowercase includes punctuation |
b ,B |
Jump cursor forward in words, lowercase with punctuation |
O |
Open a new line |
^ |
Start of a line |
$ |
End of Line |
gg |
The first line of the document |
[N]G |
The nth or last line of the document |
# # #插入模式 (Insert Mode)
Command |
function (explanation) |
i |
Insert to front of cursor |
I |
Insert to start of line |
a |
Insert to the back of the cursor |
A |
Insert to last position of line |
o ,O |
Open a new line |
Esc |
Turn off insert mode |
# # #编辑 (Editing)
Command |
function (explanation) |
r |
Replaces one character in the insertion mode with the cursor |
J |
Merge next line to previous line |
s |
Deletes the cursor's character, and the cursor is still in line |
S |
Delete the row where the cursor is located, and the cursor is still in line, unlikedd |
u |
Undo previous Action |
ctrl +r |
Redo the previous action |
. |
Repeat the last command |
~ |
Transform to uppercase |
[N]>> |
A row or n line moves to the right one tab |
[N]<< |
Move one tab to the left of a row or n line |
# # #关闭 (Exiting)
Command |
function (explanation) |
:w |
Save |
:wq ,:x |
Save and close |
:q |
Off (Saved) |
:q! |
Force Close |
# # #搜索 (Search)
Command |
function (explanation) |
/pattern |
Search (non-insert mode) |
?pattern |
Search backwards |
n |
The cursor reaches the previous target of the search result |
N |
The cursor reaches the next target of the search result |
# # #视觉模式 (Visual Mode)
Command |
function (explanation) |
v |
Select one or more characters |
V |
Select a row |
# # #剪切和复制 (Cut and Paste)
Command |
function (explanation) |
dd |
Delete a row |
dw |
Delete a word |
x |
Delete a character after |
X |
Delete the previous character |
D |
Delete the last character of a line |
[N]yy |
Copy one row or n rows |
yw |
Copy a Word |
p |
Paste |
# # #窗口操作
Command |
function (explanation) |
:split |
Split a window horizontally |
:vsplit |
Split a window vertically |
:close |
Close window |
Ctrl +W |
Switch window, to the h left window, j to the bottom window, k to the upper window, l to the right window |
Vim Common directives