VIM editor Usage Details, vim editor details
The Vim text editor is installed on all Linux operating systems by default. It is a very useful editor.
Three Modes
It has three modes: Command mode and last line mode.
Command mode: controls the movement of the cursor to copy, paste, delete, and search the text.
Input mode: normal text input.
Last line mode: Save or exit the document, and set the editing environment.
Command
Command |
Function |
: W |
Save |
: Q |
Exit |
: Q! |
Force exit (discard the modified content of the document) |
: Wq! |
Force save and exit |
: Set nu |
Show row number |
: Set nonu |
Do not show row number |
: Command |
Run this command |
: Integer |
Jump to this row |
Use Vim + space + file name. after entering the Vim editor, you need to enter the input mode before writing the file. After writing the file, press the ESC key to return to the command mode from the input mode, and then enter: you can switch wq to the Moxing mode to save and exit the operation.
Configure Nic Information
After a simple Vim operation, we can configure the NIC information.
Switch to the/etc/sysconfig/network-scripts directory and store the NIC configuration file;
Then use the Vim editor to modify the NIC file. If you do not know the NIC file name, run the ifconfig command to confirm the NIC name.
Finally, enable the NIC information change. After the configuration is released, the change takes effect only after the NIC is restarted.
Write scripts
The Vim editor is even more powerful in writing scripts. You can execute commands without executing them yourself. We can write some operations that can be completed only by linux, instead of manual input, you can perform the operation on a regular basis. Of course, we can also write scripts that can interact with users. You just can't think of them, but you can't do it without them. Let's talk about how to write the script later.