17. Vim Introduction, Vim color display and move cursor, VIM general mode move cursor, VIM general mode copy, cut and paste
I. Introduction of VIM
Vim:vi version of the upgrade, the difference is: VI when editing text will not display color, and vim will.
Its configuration file:/ETC/VIMRC,
Some advanced features can be configured in this configuration file/ROOT/.VIMRC.
If there is no VIM tool, install it as follows:
# yum Install-y vim-enhanced
VIM has three modes: General mode, edit mode and command mode. (Need to remember)
General Mode : When vim edits a file, it enters the general mode of the file by default. In this mode, you can move the cursor up or down, delete a character, delete a row, and copy or paste one or more rows.
edit Mode : You cannot modify a character in general mode, and you can only enter edit mode if you want to modify the character. From general mode to edit mode, simply press I, I, A, A, O, O, R, and R for a key. When you enter edit mode, an INSERT or replace Word appears at the end of the screen (if your CentOS supports Chinese, "insert" is displayed). From edit mode back to normal mode, press ESC.
Command mode : Enter: or/To enter command mode. In this mode, you can search for characters or strings, and you can save, replace, exit, display line numbers, and so on.
Second, Vim color display and move the cursor
The same file may cause the color to not exist under different files, and the files under/etc will often show the color.
There are lines in the file that begin with #, copied to another directory, and color is displayed.
The color display is related to the contents and file name of the document.
Move cursor
SPACEBAR: Move right.
Usage: For example, press 5, then press space, and move 5 characters to the right. Other keys, enter the number first, then press the arrow key.
Change the filename suffix to. conf,. sh to display colors.
Third, the VIM general mode copy, cut and paste
NDD: When you enter a number, it is down/cut n rows. Nyy.
U: Recover up to 50 times. Ctrl+r: Anti-recovery.
x: actually cut one character. You can also lose numbers and press these keys.
17. Vim Introduction, Vim color display and move cursor, VIM general mode move cursor, VIM general mode copy, cut and stick