This article mainly teaches you how to use the Vim split screen function.
Split screen start vim
- Use the uppercase O parameter to split the screen vertically.
vim -On file1 file2 ...
- Use the lowercase o parameter to split the screen horizontally.
vim -on file1 file2 ...
Note: N is a number that is divided into several screens.
Turn off split screen
- Closes the current window.
Ctrl+W c
- Closes the current window, leaving vim if only the last one is left.
Ctrl+W q
Split screen
- Splits the currently open file up and down.
Ctrl+W s
- Split up and down and open a new file.
:sp filename
- Splits the currently open file left and right.
Ctrl+W v
- Split left and right, and open a new file.
: VSP filename
Move cursor
VI in the cursor key is H, J, K, L, to switch between the various screens, only need to first click Ctrl+w
- Move the cursor to the right screen.
Ctrl+W l
- Move the cursor to the left screen.
Ctrl+W h
- Move the cursor over the top screen.
Ctrl+W k
- Move the cursor to the bottom screen.
Ctrl+W j
- Move the cursor to the next screen.
Ctrl+w W
Mobile split Screen
This feature also uses VIM's cursor keys, but it's all capitalized. Of course, if your split screen is very messy and complicated, this feature may have some very strange symptoms.
- Move right.
Ctrl+W L
- Move left
Ctrl+W H
- Move Up
Ctrl+W K
- Move Down
Ctrl+W J
Screen size
Here are some of the things that change the size, mostly height, you can use Ctrl+w < or for width, but this may require the latest version to support.
- Let all the screens have the same height.
Ctrl+W =
- Increase the height.
Ctrl+W +
- Reduce height.
Ctrl+W -
也许还有其它我不知道的,欢迎你补充。
Vim's split-screen function