Linux system text editor, vi Common Commands Explanation (operation and demonstration)

introduction:

In Linux we have a favorite text editor, vi, vim (vi enhanced version). And vi editor is not only applicable to Linux, Unix, and it is all standard editor for Linux systems, suitable for almost all versions of Unix, Linux systems.
vi or vim Although there is no simple graphical editor that point the mouse, but the vi editor in systems management, server management interface characters, never GUI editor can compare. It can easily create and edit text files, configuration files maintain Linux systems.
Learn it, you have the key to open the door to Linux.

main content:

three operating modes vi editor
substantially Command Mode Operation
The basic operation of the command line mode

Three operating modes vi editor:

1. Command Mode command mode):
control movement of the screen cursor, deleting a character, word, or row, moved, copied to a section. And enter the edit mode (Insert mode) and line mode (last line mode).

2. Edit mode (Insert mode):
Only in editing mode (Insert mode), it can be done entering text, press [ESC] key to return to the command line mode.

3. line mode (last line mode):
Save the file or exit vi, you can also set the editing environment, such as finding strings, lists the line number and so on .......

4. switch between three operating modes:
paying attention not switch back and forth between the three modes, only in command mode to enter edit mode and line mode.
Linux system text editor, vi Common Commands Explanation (operation and demonstration)
Here explain "a, i, o, O " , etc. are all key to enter the edit mode, and that there is any difference between them:
press [a] to enter the edit mode, the input text is started after the current cursor position;
press [ after i] to enter the edit mode, the start of the input file before the current cursor location;
press [o] to enter the edit mode, to add a new row in the cursor position to the next row, from the first line start typing;
press [O after the] key to enter edit mode, is adding a new line at the cursor position on the line, and start typing from the beginning of the line.
The following text is to demonstrate I, I cursor on the unity of "this" "t", then test1, test2, test3, test4 demonstrate respectively [a], [i], [o], [O] bond function:
Linux system text editor, vi Common Commands Explanation (operation and demonstration)
5. save and exit the vi editor:
: w filename (to save the file specified)
Linux system text editor, vi Common Commands Explanation (operation and demonstration)
: WQ (save all edits and exit vi)
Linux system text editor, vi Common Commands Explanation (operation and demonstration)
:! q (input q !, force quit without saving vi)
Linux system text editor, vi Common Commands Explanation (operation and demonstration)

Guess you like

Origin blog.51cto.com/14449541/2429597