One, Mode
There are 3 modes of the VI Editor:Command mode、Input Mode、last-line mode。 It is important to master these three models:
Command mode: VI starts after the default entry is the command mode, from this mode use the command can switch to the other two modes, while in any mode just click [ESC] Key to return to command mode.
Input mode: Enter subtitles in command mode"I"You can edit the file into the input mode of VI. In this mode we can edit, modify, input and other editing work, in the last line of the editor to display a "--insert--" Mark VI entered the input mode. We need to save the file when we have finished modifying the input, then we need to return to the command mode and save it in the last line mode.
Last-line mode: Input in command mode":"To enter this mode, there are many useful commands in the last line mode.
Two, copy
A, copy the entire row
Command mode, the cursor is in the current row to be copied, enteryy
b, copy a word
Command mode, the cursor is in the first letter of the current word to be copied, enteryw
Three, paste
Command mode, enterP
Four, delete
A, delete the entire row
Command mode, the cursor is in the row you want to delete, enterDD
B, delete a word
Command mode, the cursor is in the first letter of the word to be deleted, enterDW
Five, Undo
Command mode, enteru
Six, Jump
Command mode,Enter the number of rows to jump, and then enter GG
such as: To jump to the 150th line of the current file, enter150gg
Linux VIM common commands