vi and vim Detailed
vi
Editor Linux is the most basic text editing tools.
vim
Ability to program editing, you can identify the grammatical correctness of the font color for easy programming.
Article Directory
Three common mode
Normal mode
Use vi
/ vim
open the file, enter the normal mode.
Commonly used commands:
i
Or Insert
: is switched to the input mode to input characters.
x
Or 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 i
or Insert
into the insert mode. This mode can be entered.
Press ESC
Exit 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: /hello
to 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.
vi / vim FIG Keyboard
Slowly summary update
. . . . . .