Linux is generally installed by default vim
, formerly known as visual interface IMproved
, is vi
an upgraded version.
# Command structure of FIG.
# Several practical instruction
(1) command mode
- Delete actions
-
x
Delete current character -
nx
Delete downwardn
characters -
dd
Delete cursor line -
ndd
Delete downn
the line -
d1G
Remove the cursor line data up to the first row -
dG
Delete the line the cursor down to the last line of data
- Jump action
-
gg
Jump to the first line of text -
nG
Jump linen
-
G
Skip to the bottom of the file -
n+
Jump downn
the line -
n-
Improved recoiln
line -
shift 4
End of the line under the cursor -
shift 6
Cursor jumps to the first line
- Copy and revocation
-
yy / nyy
Copy the line cursor, plusn
express copy downn
the line -
y^
Assignment cursor to the first line of content -
y$
SUMMARY assignment cursor to the end -
p
After copying the contents of the cursor -
P
Copy the contents before cursor -
u
A revocation operation, restoring a state before -
U
Undo the current line all operations
- Search matches
-
/vpser
Down searchvpser
string -
?vpser
Up searchvpser
string -
n
Search down before a search operation -
N
Search up before a search operation
- Move the cursor
-
上下左右
up down left right -
h
left -
j
under -
k
on -
l
right
(2) Input (edit) mode
-
i / I
At the cursor from lowercase input, capital input from the start line where the first non-space office -
a / A
Start typing a lowercase character from the cursor, the cursor line from the capital last character input -
o / O
Lowercase new line of input lines from the cursor line, next line from the cursor uppercase input newline -
insert
Switch the cursor to an input / replace mode -
Esc
Exit input mode, switch to command mode
(3) the bottom line of command mode
Input mode, press the Esc
exit to command mode, then enter :
to enter command mode the bottom line
-
:w
Storage -
:w!
Forced to save -
:wq
Save and exit -
:q!
Give up Logout
- Set the line number
-
:set nu
Show Line Numbers -
:set nonu
Cancel Display line numbers
Reproduced in: https: //www.jianshu.com/p/8029e26a7d36