Linux VI Command text insert operation (append,insert,open)

Source: Internet
Author: User

1. Inserting (INSERT) command

VI provided two INSERT commands: I and I.

(1). The I command inserts text from the position before the cursor, and you can use the key to delete the wrong input during the insert process. At this time VI is in the Insert State, the screen is the most downward display "–insert–" inserted words.

(2). I command the command to move the cursor to the beginning of the current line, and then insert the text before it.

2. Additional (append) Order

VI provides two additional insert commands: A and A.

(1). A command the command is used to append new text after the cursor is currently in place, the new text is placed after the cursor, and the original text after the cursor is moved backward accordingly, and the cursor can be anywhere on one line.

(2). A command the command differs from a command, a command moves the cursor to the end of the line at which it is inserted, inserts new text from there, and automatically moves to the end of the line when you enter a command.

The A and a commands are the only way to insert text at the end of a line.

3. Open command

Whether it's an insert command or a append command, the inserted content starts at a location in the current row. If we want to insert some new rows before or after a row, you should use the Open command.

VI offers two open commands: O and O.

(1). o command the command will open a new line below the line where the cursor is located, and place the cursor at the beginning of the line, waiting for the input text. Note that when you use delete characters, you can only delete characters that start at the beginning of the insertion mode, and do not work for previous characters.

(2). o command and O command instead, the O command inserts a row above the line where the cursor is positioned and places the cursor at the beginning of the line, waiting for the input text.

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.