Before I did not know why to learn the Vim and VI editor, just heard people say that this is important to Linux.
First of all, why study this editor, the individual reading comprehension.
The important task of a system administrator is to participate in and set up configuration files for some important software, so at least learn more than one text editor for the command line interface. In all Linux distributions a set of text editor is the VI, and many of the software by default also use VI as their editing interface. Vim is the advanced version of the VI,VI is the old-fashioned word processor, VIM can not only use different colors to display the text content, but also to do such as Shell script, C and other programming functions, can speak vim as a program editor. Although the Nano can also be used for text editing, but other versions of the system may not necessarily have, but there will be a VI.
Use of VI:
VI is divided into three modes: General mode, edit mode, command line mode.
1, the general mode: VI open a file directly into the general mode.
2, editing mode: in the general mode , can not edit the contents of the file, to press "I,i,o,o,a,a,r,r" and so on any one of the letters before entering the editing mode. To return to normal mode, press ESC.
3. Command line mode: in general mode , enter ":,/,?" Any one of them can move the cursor to the bottom line, in this mode, you can provide the operation to find data, while reading, saving, a large number of substitution characters, leaving VI, display line number and other operations are done in this mode.
Vim's three modes are only normal mode can be changed with edit, command line mode switch, edit mode and command line mode is not able to switch.
Here are a few keys that I think I need to figure out:
: W writes the edited data to the hard disk file;
: w! If the file property is read-only, the file is forced to be written. However, the ability to write can also be related to their own permissions.
: Q Leave VI
: q! If you have modified the file, do not want to store, use! Force leave do not save file
: Wq left after saving
: wq! If your file cannot be written, such as a read-only file, when you edit it, if you use: Wq will prompt for a read-only file, this time you can use: wq! To force a write save.
Basics of the Linux Vim,vi editor