VI belongs to the Linux kernel built-in command (vi editor)
1. Vi/vim Working principle
Before you learn Vi/vim editor parameters and shortcut keys, you need to understand how Vi/vim works first. The Vi/vim command has three modes: edit mode, view mode, command mode, and different modes to execute different commands.
2, VIM based on the VI development of the editor, and the VI command consistent
I: Insert (enter edit mode)
ESC key: Exit edit mode to enter view mode or exit Command mode to enter view mode
"Shift+:": Entering command mode from view mode
View mode operation The following command, edit mode no
U: Undo (If you don't want to delete the row you just deleted, you can cancel the delete operation)
X: Delete
V: Select text
Y: Copy
YY: Copy when moving forward
DD: Delete cursor in the row
P: Paste
/: Search Down
? : Search up (using the search command/or? After pressing the N key to continue the next search)
GG: Cursor moves to the first line of the file
G: Cursor moves to the last line of the file
0: Move the cursor to the beginning of the line
SHIFT+4: Moves the cursor to the end of the line
Operation in command mode
: W Save
: Wq Save Exit
: q! Do not save/force exit
: w! Force write, the original file is not allowed to write the state of the column, such as a read-only file, the command can be forced to write, if the user is the owner of the file, the Superuser is not subject to this restriction.
: Set Nu (mber) Displays line number "Set Nonu cancel line number"
VI and Vim Text editor principles, parameters and shortcut keys