Linux of vi, vim editor

Introduce Linux important VI, VIM editor

1.VI, what VIM IS?

VI, VIM is a text editor under Linux system command line.
Use the command vi filename or vim filename.

2. The three modes

① normal mode (the default mode)
by vi or vim to open the document to enter general mode, this mode is mainly responsible for viewing and some basic pruning
common operations:

command Explanation
dd Delete current line cursor
dnd Delete n lines
in Undo the last step
x To delete a letter, similar to the Delete function on the keyboard
X To delete a letter, similar to the keyboard Backspace function
yy Copy the current cursor line
p Stick
dw To delete a word
is Copy a word
Shift+g Move to footer
1+Shift+g Move to the goal line
N+shift+g Moved to the N-th row
Shift+6 To move the line head
Shift+4 Move to the end of the line

② edit mode
. In the normal mode the word letter by i, a, o into edit mode, inserted into the bottom left corner [there] To exit the edit mode, press [ESC] key
common operations:

command Explanation
i Current cursor before entry
a After the current cursor entry
O The next line of the current cursor row entry
I The first line of entry
A End of the line entry
O Entry on the current line of the cursor line

③ command mode
input in the normal mode / or: command mode, the command save mode may be used to exit the VIM, line numbers, search, replace, etc. bulk.
Common operations:

command Explanation
:w Storage
:q drop out
:! Enforcement
:%/s/old/new Batch Replace
/ To find the word Searches, a look - n, N lookup on a
: Not set Show Line Numbers
:set nonu Close line number
noh Cancel Highlight
3. The relationship between the three switching modes

在这里插入图片描述

4.VI, VIM keyboard map

在这里插入图片描述

发布了166 篇原创文章 · 获赞 585 · 访问量 6万+

Guess you like

Origin blog.csdn.net/zxdspaopao/article/details/103754074