Vim multi-window editing

Source: Internet
Author: User
Tags expression engine

Vim provides the multi-window editing function to simplify compound editing tasks. The multi-window mode of Vim does not mean that multiple Vim instances are started on the terminal.
 
Enable multi-window editing
 
Multiple windows in Vim are dynamic. You can open multiple windows when you start editing, add new windows at any time during work, or delete a window.
$ Vim-o file1 file2 opens an editing session, which is displayed as a horizontally split window in two halves. A file occupies one window.
$ Vim-O file1 file2 is the same as above, but it is a Vertical Split Window

As shown in the following figure:

 
If the split screen is not enough to accommodate all the windows, the first file occupies most of the windows, and the remaining windows are loaded into the buffer zone, which cannot be seen yet, but can still be used.
 
-O is followed by a number n, which is opened in the pre-allocation window:
$ Vim-o5 file1 file2 will allocate 5 identical windows with 3 Idle

Multi-Window editing of vim
 
: Split creates a new window and splits the current window into two halves. they display the content of the same buffer zone (the same file ). In this way, you can browse the same file in two windows.
 
: Vsplit creates a new Vertical Split Window, which also displays the same file content as the current window. The effect is as follows:


 
When you edit the same file in multiple windows (such as deleting a row), all windows with the same file will reflect the effect at the same time, because they share the same file buffer.
 
If you want to edit or browse another file and do not want to lose the editing position in the current file, use the parameters of the new file to pass to the split command.
: Split otherfile

Recommended reading:

Vim Learning Guide
Quick learn Vi Editor
Powerful Vim Editor
Build a Vim Development Environment on CentOS 6.2
Vim 7.4a released, a new and faster Regular Expression Engine
Install the highlighted Vim editing tool in CentOS 5.4
Vim tips: C language settings
Set the Vim row number in Ubuntu

For more details of this article, please continue to read the highlights of page 2nd:

  • 1
  • 2
  • Next Page

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.