Multi-Window usage techniques for VIM under Linux system

Source: Internet
Author: User

Using the VSP command:

For example: There are files under a folder:

The code is as follows:

vector.cc, substr.cc

1. Open any file using the VIM command: Vim vector.cc open the first file. As shown in the following illustration:

2. Press: "ESC" key + ":", and enter

The code is as follows:

: VSP substr.cc

。 (Here vsp is like the vi/vim operation, the path is free to switch.) ) as shown in the following illustration:

3. Press the "Enter" key. As shown in the following illustration:

4. To allow the mouse to switch freely between several screens.
Press: "ESC" key + ":", enter:

The code is as follows:

Set Mouse=a

。 Then, enter (enter) so that the mouse can move freely between the multiple screens. As shown in the following illustration:

Vim Multi-Window general operation:

1, open multiple Windows
command to open multiple windows The following:
Landscape cut window
: new+ window name (after saving is file name)
: split+ window name, also can be abbreviated as: sp+ window name
Portrait cutting window name
: vsplit+ window name, can also be abbreviated as follows: vsp+ window name
2, close multiple Windows
can be used: q!, also can use: Close, the last window can not be closed with closing. Using close only temporarily closes the window, its contents are still in the cache, and only q!, w!, or x can really quit.
: TABC Closes the current window
: Tabo closes all Windows
3, window switch
: ctrl+w+j/k, through the j/k can switch up and down, or: Ctrl+w plus the next key, you can also double-click the ctrl+w to switch windows in turn.
4, Window sizing
Portrait adjustment
: Ctrl+w + Portrait expansion (increase in number of rows)
: ctrl+w-Zoom down (decrease in number of rows)
: Res (ize) num  For example:: Res 5, show rows adjusted to 5 lines
: Res (ize) +num adds the current window height to num rows
: Res (ize)-num reduce the current window height by num line
Landscape adjustment
: Vertical res (ize) num Specifies that the current window is a num column
: Vertical res (ize) +num adds the current window to the NUM column
: Vertical res (ize)-num reduce the current Window num column
5, rename the window
: F file
6, vi Open multiple files
VI a B C
: N jumps to the next file, you can also directly specify the file to jump, such as: N C, you can jump directly to the C file
: e# back to the file you just edited
7, file browsing
: Ex Open Directory Browser, you can browse the current directory of all files, and can choose
: Sex horizontally splits the current window and opens the Directory browser in a window
: LS Displays current buffer condition
8, VI and Shell switch
: Shell can switch to shell command line without closing VI: Exit From the shell back to VI

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.