vi and vim Detailed

vi and vim Detailed

Here Insert Picture Description
Here Insert Picture Description
viEditor Linux is the most basic text editing tools.

vimAbility to program editing, you can identify the grammatical correctness of the font color for easy programming.

Three common mode

Normal mode

Use vi/ vimopen the file, enter the normal mode.

Commonly used commands:

iOr Insert: is switched to the input mode to input characters.
xOr Delete: Delete the character at the current cursor position.
:: Switching to command mode, the command to enter the bottom row.
yy: Copy an entire row
数字yy: copy of the current row down lines, such as: 5yy -> copy of the current line to a lower line 5
p: Paste
dd: delete an entire row
数字dd: a plurality of rows and a similar replication
gg: first line to move the cursor
G: Move the cursor the last line
方向键: move the cursor
to edit text -> start vi/ vim-> to enter the command mode -> press I -> switching to the input mode.

Insert mode

In the normal mode, press ior Insertinto the insert mode. This mode can be entered.

Press ESCExit insert mode, enter :into the command line, the bottom row in order to enter commands.

Command line mode

Press :( colon) in normal mode to enter the command line mode.

Bottom Line Command Mode can enter commands single or multiple characters.

:set nu: Display line numbers
:set nonu: do not display line numbers
:/元素: find elements in the open file, such as: /helloto find the Hello
:wq: After saving to leave
:q!if there had been revised files, do not want to store, use forced leave without saving the file:!
:w: The edited data written to disk file
:w!: If the file attribute 只读when forced to write to the file, of course, rights issues
:q: leaving vi

Conversion of the three models of FIG.

Here Insert Picture Description

vi / vim FIG Keyboard

Here Insert Picture Description
Slowly summary update
. . . . . .

Published 55 original articles · won praise 30 · views 9815

Guess you like

Origin blog.csdn.net/chaifang0620/article/details/104851775