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 (Cursors movement) the cursor forward in words, lowercase contains punctuation
command |
effect (explanation) |
h,j,k,l |
H for left, J for Down, K for right, l to |
Ctrl + F |
previous |
Ctrl + b |
next |
w , e , W , E |
jumps to the back of the word, lowercase includes punctuation |
b , b |
O |
start a new line |
^ |
Line start |
$ |
end of line |
Gg |
first line of the document |
[n]g |
the nth or last line of a document |
Insertion modes (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 |
Editor (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 |
Close (Exiting)
Command |
function (explanation) |
:w |
Save |
:wq ,:x |
Save and close |
:q |
Off (Saved) |
:q! |
Force Close |
Searching (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 modes (visual mode)
Command |
function (explanation) |
v |
Select one or more characters |
V |
Select a row |
Cut and copy (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 |
Window operations
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 General Command Summary