Vim Split window Split command

Source: Internet
Author: User

Displaying two different files, or displaying two different places of a file at the same time, or comparing two
Thing This can all be achieved through the split window.

The simplest command to open a new window is as follows:

: Split (split horizontally) | | : Vsplit (vertical split)
This command breaks the screen into two windows and places the cursor in the window above.

The ctrl-w W command can be used to jump between windows. If you are in the window above, it will jump to the window below,
If you are in the window below, it will jump to the window above. (Ctrl-w ctrl-w can do the same function this
is to avoid you sometimes press the second time from the CTRL key to scaling back late. )

Close window ": Close"
Any command that exits the edit can close the window, like ": Quit" and "ZZ", and so on. But "close" can
To prevent you from accidentally exiting Vim when you have a window left. (Very important setting AH ~)

Close all other Windows ": only"
This command closes all windows except the current window. If there is one in the window to be closed without a disk, Vim will display
Error message, and the window will not be closed.

Open the specified file (two.c) with split window ": Split two.c"

Create new file in Split form ": New"

Jump between windows (how to say, now the mouse can be replaced, but in order to improve efficiency, it is recommended to see)

Since you can open any number of Windows with vertical split and horizontal split commands, you will be able to set the window's cloth arbitrarily
Council. Next, you can jump between windows with the following command:

Ctrl-w h jump to the left window
Ctrl-w J jump to the window below
Ctrl-w K jump to the upper window
Ctrl-w L jump to the right window

Ctrl-w T jumps to the topmost window
Ctrl-w b Jump to the bottom of the window

You may have noticed here that you use the same commands as the move cursor for jumping windows. If you like, use direction
Key is also OK.

Move window

If you find that the file order is not what you expect when you split multiple files. by changing

Ctrl-w K moves the current window to the top and expands to the width of the entire screen.
Ctrl-w H Move the current window to the far left
Ctrl-w J Move the current window to the bottom
Ctrl-w L Move the current window to the far right

If you look at it, you'll find that you still h-j-k-l four keys. This is just a capitalization.

################################################################################
Execute commands on all windows

: Qall
This means "Quit all" (Exit All). If any of the windows are not saved, Vim will not exit. Simultaneous light
Bidding clubs automatically jumps to that window, you can save the file with the ": Write" command or ": quit!" to discard the changes.

: Wall
This means "Write all" (save All). But in fact, it will only save the modified file. Vim knows to save
There is no point in a file that has not been modified. (Very interesting AH ~ ~)

Vim-o one.txt two.txt three.txt This command is used under the terminal, is the one-time open 3 files and use the Split form display.

Transferred from: http://www.linuxidc.com/Linux/2012-08/69363.htm

Vim Split window Split command

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.