17. Vim Introduction, Vim color display and move cursor, VIM general mode move cursor, VIM general mode copy, cut and stick

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.