"Vim" Split window and tab page

Source: Internet
Author: User

Vim supports window segmentation and tabbed pages, and using these two features appropriately makes the text editing tool more enjoyable.

1. Window segmentation

VIM supports horizontal and vertical segmentation of Windows. The following are commonly used operation instructions or shortcut keys.

Command Description
Vim-o <files> Open multiple files and place them in a split-level window
Vim-o <files> Open multiple files and place them in a vertically split window
: Sp[lit] [file]

When no file parameter is added, a new horizontal window is created, and a copy of the current file is placed;
With the file parameter, create a new horizontal window and place the file in a new window.

The new window will be positioned above the current window and the cursor is in a new window.

: Vsp[lit] [file]

When the file parameter is not added, a new vertical window is created to place a copy of the current document;
With the file parameter, create a new vertical window and place the file in a new window.

The new window will be positioned to the left of the current window and the cursor is in a new window.

: Qa[ll] Close all windows and exit
: Wa[ll] Save the contents of all Windows
: on[ly]
<ctrl>+w+o
Close all other windows outside the current window
: Clo[se]
<ctrl>+w+c
Close the current window
<ctrl>+w+h Move the cursor to the window to the left of the current window
<ctrl>+w+j .............................. The next .....
<ctrl>+w+k .............................. On ......
<ctrl>+w+l .............................. Right........... (L is the lowercase letter L)
<ctrl>+w+t Move the cursor to the first window
<ctrl>+w+b Move the cursor to the last window
<ctrl>+w+h Move the current window to the far left
<ctrl>+w+j ........................... The next ...
<ctrl>+w+k ........................... On ...
<ctrl>+w+l ........................... Right...
<ctrl>+w+r

Scrolls the current window list forward one position (if there are 3 vertical windows, start from left to right in order
ABC, then execute this command in either window, it will become a BCA, then execute into a cab, so back and forth);

When there are only two windows, swap the positions of these two windows.

<ctrl>+w++ Increase the height of the current window (by default, one row)
<ctrl>+w+- Reduce....................
<Ctrl>+w+> Increase the width of the current window (default is a column)
<Ctrl>+w+< Reduce....................
<ctrl>+w+= Make all windows the same width/height (both horizontal and vertical).
: Res[ize] <N>
: Res[ize] +<n>
: Res[ize]-<n>
Adjust the height of the current window: n rows, n rows, n rows
: vert[ical] res[ize] <N>
: vert[ical] res[ize] +<n>
: vert[ical] res[ize]-<n>
Adjust the width of the current window: n columns, n columns, n columns

In addition VIM provides the Quickfix window, after executing commands such as vimgrep, the result will be displayed in the Quickfix window, run: CW command to exhale this window.

2. tab page

The split window can sometimes appear to be confusing to the Vim interface, when the tab is another option. The following are commonly used operation instructions or shortcut keys.

Command Description
Vim-p <files> Open multiple files and place them in a label
: Tabe[dit] <file> Creates a new tab after the current tab, where the contents of file are placed
: Tabnew <file> Create a new file and create a new tab for it
: Tabo[only] Close other tabs
: Tabc[lose]
: Q
Close the current tab page
Gt Open next tab page
GT ...... Last.........
: Tabfir[st]
: Tabr[ewind]
Open the first tab of the page
: Tabl[ast] Open the Last tab page
: Tabm[ove] <N>
: Tabm[ove] +<n>
: Tabm[ove]-<n>
Move tab: Move to position N, move N to the right, n position to left
: Tabs Show current tab page
: Help Tab-page-intro Query Tab Related commands

Vim Split window and tab page

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.