Vim open document and multi-document editing

Source: Internet
Author: User

 

1. Vim open the document:

1. Open the document using Vim document name in Normal Mode
2. VIM + N document name after opening the document, locate the nth line
3. VIM: Enter the vim interface and run the command "E document name" to open the document. This method can be used to open another document while editing a document.

Ii. Multi-document editing:

 

1. Vim document 1 Document 2...

2. VIM: Enter vim and use the E document name to open the document.

3. The command for multi-document editing is as follows:

: N: edit the next document.
: 2n: edit the following two documents.
: N: edit the previous document. Note: This method can only be used to open multiple documents at the same time.
: E document name. This is to open other documents without leaving Vim after entering vim.
: E # or Ctrl + ← edit the previous document, which is used when two documents exchange and edit each other .? # Indicates editing the previous edited document.
: Files or: buffers or: ls can list all documents in the current buffer zone. The plus sign + indicates that the buffer has been modified. # Indicates the Last edited document. % indicates the document being edited.
: Enter the document name or number B to this document.
: F or Ctrl + G displays the name of the document being edited.
: F branch name changes the document name in editing. (File)

3. Exit Vim
: Q: if the text is not modified, the system exits. Otherwise, a warning is displayed and the system cannot exit.
: Q! Discard all modifications and forcibly exit.
: After WQ is saved, it is saved again even if the document has not been modified.
: X is saved and left. If the document has not been modified, it will not be saved and left directly.
: W file name: Save. If the document name is not added, the original document is written.
: QA or QA! Exit Vim when multiple documents are opened. A means all.

 

4. Multi-Window editing

: SP document name open document in new window

Two Ctrl + W windows can be switched

: Q: exit the current editing window.

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.