VI and VIM

Source: Internet
Author: User

VI Vim

Linux has multiple editors, but different distribution, VI is basically supported on every distribution.

Vim is an enhanced version of VI. Vim has the ability to edit the program, can be active in font color to identify the correctness of the grammar, convenient programming.

Three Modes of VI:

Three modes of the VIM Editor: normal mode, edit mode, and command line mode.

You can delete, copy, and paste in general mode, but you cannot edit the contents of the file more explicitly.

Switch from general mode to edit mode to press I, I, O, O, A, a, R, R keys. As described below, the individual feel that only need to remember I can be.

    • I,i: Enter insert mode,I is inserted from the current cursor location . I begin the insertion at the first non-whitespace character at the current row.
    • A,a: Enter insert mode. A is the insertion starting at the next character where the cursor is currently located. A is inserted starting at the last character of the row.
    • O,o: Enter insert mode. O is inserted on the next line. O is inserted on the previous line.
    • R,r: Enter replacement mode. R replaces only the same character as the cursor. R will always replace the character of the cursor until the ESC key is pressed.

Switch from edit mode to Austrian General mode: ESC.

In the general mode, enter:,/,? Any of the three can move the cursor to the bottom line, that is, command mode, in this mode can provide the operation to find data, read, save, a large number of substitution characters, leaving VII, display line number and other operations are done in this mode.

There is no way to switch between edit mode and command-line mode.

In general mode, the commands you can execute are:

command to move the cursor:

    • PgDn Key: Next page (This command is also valid in edit mode)
    • PgUp Key: Previous page (This command is also valid in edit mode)
    • Home key: The cursor moves to the front of the first character of the line (this command also works in edit mode)
    • End key: The cursor moves to the back of the last character in the line (this command also works in edit mode)
    • G: Cursor moves to the last line
    • 1G or GG: Move the cursor to the first line
    • 10G: Cursor moves to line 10th
    • Enter 10 and press ENTER: The cursor moves down 10 lines.

VI and VIM

Related Article

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.