VIM Multi-file Multi-window function

Source: Internet
Author: User
Tags switches

Multi-file editing

Many times, we need to copy the contents of a file into the B file. If we use two vim windows to edit two files, the pasted content cannot cross the window.

Enter the following command to open multiple files in one window at the same time

vim file1, file2, file3

Use the command:

vi A.txt B.txt

In command mode input: Files to view the Open file list:

Command mode input:

    • : N Edit Next file
    • : N Edit Last File
    • : Files lists all the files that are currently open by this vim
Multi-window editing

Described above is a window to open one or more files, Vim also provides multiple windows to open one or more files.

Sometimes, when a file is particularly large, such as 1000 rows, when looking at the data in the back, we need to compare with the previous data, when the multi-window is very useful.

Command mode:

    • SP filename opens a new window, if there is a filename, indicates that a new file is opened in a new window, otherwise a new window displays the same file (synchronized display)
    • The Vim window opened by VSP filename is arranged vertically;
    • Cursor switching between windows
      • Ctr + W + j (bottom arrow): Cursor switches to next window
      • Ctr + W + k (UP ARROW): Cursor switches to previous window

Effects such as:
SP filename

VSP filename

: Set mouse=a makes the mouse active in Vim, you can use the mouse to move the cursor to drag the Vim window.

VIM Multi-file Multi-window function

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.