1. Character Operation
I insert
I Insert at the beginning of the line
A Line End Insert
X Delete one character after
X Delete one character after
U undo One Step
2. Line Operation
The home or ^ key moves to the beginning of the line
End key or $ move to End-of-line
NDD Delete n row, also cut n row
P Paste
3. V Mode
Ctrl + V enters v mode, can be batch commented
Enter the V-mode cursor Select n line, press I input #, the ESC key exits and completes the comment.
Enter v mode, select N row, press D to cancel N line comment
4. Replace
The first this occurrence of each row is changed to that
:%s/this/that/
All occurrences of this in the file are changed to that
:%s/this/that/g
Replace each 2~5 in the line
: 2,5 s/this/that/g #注意是s不是%s
5. Miscellaneous
To invoke system commands within a file:
:!ifconfig #即感叹号 + command
: Set Nu #加行号
: Set Nonu #取消行号
: Noh #取消高亮
GG navigates to the beginning of the line
G positioning to end of line
: N positioned to DIN line
: R a.txt #读其他文件到本文件
6. Customizing Vim
Mainly used in writing scripts or other development, the following simple example
Can be used in/ETC/VIMRC files so that all users are in effect
Can be in the user's home directory:
Vim/vimrc
Set Nu
Set history=10000
....
7. Gedit
In addition to Vim can also use gedit
Run gedit can start gedit, graphical operation can be.