1. Vim open the document:
- Vim document name open document in Normal Mode
- VIM + N document name after opening the document, locate row n
- 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:
Vim document 1 Document 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. It 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.