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: