Use of VIM Editor

Source: Internet
Author: User

Directly go to the topic:

Basically, VI is divided into three modes: general mode, edit mode, and command mode. The functions of these three modes are as follows:

Normal Mode: open a file using vi and directly enter the normal mode. In this mode, you can move the cursor by using the upper/lower keys. You can delete characters or the entire line, you can also copy and paste your file data.

Edit mode: In normal mode, you can delete, copy, paste, and other operations, but you cannot edit the file content. You need to press I, I, O, O, a,, enter the editing mode after any letter, such as R and R, and Press ESC to exit the editing mode.

Command mode: In general mode, enter :,/,? The character enters the command mode. In this mode, you can provide operations for searching data, while reading, saving, replacing a large number of characters, leaving VI, the row number is displayed in this mode.

 

Common Operations of VI:

The following buttons can be used to switch the general mode to the command mode:

: W writes the edited data to the hard disk

Write Data to Hard Disk

: Q exit vi

: Q! If you have changed the file and it is not like storage, use it! To force exit without saving the file

: Set nu display row number

: Set Nonu cancel row number

 

Common buttons in Normal Mode

Dd deletes the row where the cursor is located.

YY copy the row where the cursor is located

U restore operation

P paste the copied data in the next row of the cursor.

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.