Linux must learn to understand the vim command

Linux is more commonly used vim text editor
mastered these operations, you can improve your text editing capabilities and on the shell script can reduce the time. Helpful to you in the operation and maintenance, in fact, to learn Linux has helped
0x00_ line number
parameter:
: the SET NU: Set line numbers
: set nonu: Cancel line number
gg: the first line
GG: to the last line
nG: to line n
: n: n-th line to
$: Position the cursor on
0: zero, moves to the end of the line

:set nu

Here Insert Picture Description
Delete 0x01_
x: delete the character at the cursor
nx: delete n characters at the cursor
dd: Delete cursor line
ndd: Delete n lines
dG: Delete cursor line end of the file contents to
D: Delete cursor line end of the line content
: n1, n2d: delete the specified range of row

:2,10d

Here Insert Picture Description
Here Insert Picture Description
0x02_ replication
yy: Copy the current line
nyy: Copy n rows
dd: the current line
ndd: Cut line n
p: stuck on the current cursor line
P: adhesive on the current cursor line

Alternatively 0x03_ canceled and
r: replace the character at the cursor
R: Start substitution character from the cursor position by the end of the ESC
u: cancel the previous operation
/ string: find, set ic insensitive
n: search for the next specified string appearance position
:% s / old / new / g: replacement of the designated text string G / C
: N1, N2S / Old / new new / G: Alternatively specified string within a predetermined range

:%s/g/kkkkkkkk/g

Here Insert Picture Description
Here Insert Picture Description
0x04_ import | execute
: r filename: import file
!: Command: Run
!: R command: execute command to import content output

:r! date

Here Insert Picture Description
Here Insert Picture Description

Published 36 original articles · won praise 9 · views 8215

Guess you like

Origin blog.csdn.net/qq_44902875/article/details/104516281