Vim Learning Note (ii): Chapter I: VI text Editor

Source: Internet
Author: User

All instructions for VIM compatible VI

The VI command has the following characteristics:

    • There's a difference in case letters.
    • Does not appear on the screen when you enter it
    • No more commands to add the ENTER key

1. Open and Close files

When you edit the text, vi copies the files you want to edit to the buffer (the part of the staging local content that is additionally set in memory), and displays the buffer (although you can see only a portion of the screen size at a time) and lets you add, delete, and change the text. When storing the edited result, Vi writes the contents of the buffer back to the permanent file, replacing the old file with the same name. Remember that you are always working on a copy of the file in the buffer.

Open File Command:

$ VI [Fikename]

The preceding command appears in square brackets, indicating that filename is optional and the square brackets themselves do not enter. If omitting Filename,vi opens an unknown buffer, we can name the contents of the buffer when it is written to the file. But the good habit is to give the file name first.

The file name must be unique in the directory, and can include any 8-bit characters except the slash (/), ASCII nul: Slash left as the directory separator, ASCII nul all parts are 0. You can even include spaces in the file name as long as you precede it with a backslash (\). It usually contains any uppercase or lowercase letters, plus dots and underscores.

Open a file under another directory to specify the full pathname, such as: $ vi/home/john/letter

2. Save and leave files

    • W: Save but do not leave VI
    • Q: Exit
    • Wq: Save, leave
    • Zz=wq
    • E! Then press ENTER: Restore the last saved content
    • Q! Then press ENTER: Remove all editing effects and leave VI
    • W! File: filename conflict occurred while saving files, this command overwrites the original file
    • W NewFile: Writes the edited result to a new file

Vim Learning Note (ii): Chapter I: VI text Editor

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.