How to adjust the width and height of the vim split screen window?
-
What to do if it's too big
Little Bear Technology...
Load more~
96980 people watched this video
The vim editor can split the screen up and down, left and right at will, especially useful. However, the default width and height of the split screen may not be appropriate and need to be adjusted by yourself.
Tools/Materials
-
vim software
Method/Step
-
After opening vim, type a colon ":" to enter the command line mode.
-
After typing "vs" in the command line mode and pressing the Enter key, the screen will be divided into two screens on the left and right.
-
Retype the colon to enter the command line mode, and then enter the following command: ":vertical res 20". Before entering the command line mode, the width of the window where the cursor is located will become 20% of the full width.
-
The change of split screen width after width adjustment:
-
If the "sp" command is typed in the command line mode, the screen will be split up and down.
-
At this time, directly use "res" to adjust the height of the split screen:
-
After height adjustment, the upper and lower split screens are as follows:
-
8
If it helps you, please support it~
vim undo the rollback operation
Press u in vi to undo an operation
u Undo the operation of the previous step
Ctrl+r to restore the operation that was undone in the previous stepNote:
If you enter "u" twice and your text is restored, it should be that your Vim is configured in Vi compatibility mode.
Redo
If you undo too much, you can type CTRL-R (redo) to undo the previous command. In other words, it revokes a revocation. To see the execution example, type CTRL-R twice. The character A and the space after it appear:
young intelligent turtle
has a special version of the undo command: "U" (line undo). The line undo command undoes all
operations on the previous edit line . Enter these commands twice to cancel the previous "U":
A very intelligent turtle
xxxx delete very
A intelligent turtle
xxxxxx delete turtle
A intelligent
use "U" to restore the line
A very intelligent turtle
use "u" to cancel "U"
A intelligent
"U" Command to change itself, "u" command to undo the operation, CTRL-R command to redo the operation. This is a bit messy, but don't
worry, you can switch to any state with "u" and CTRL-R commands.Popular text editors usually have forward and backward functions, allowing you to move back and forth between previously viewed locations in the file. In vim, use Ctrl-O to go back and Ctrl-I to go forward.
Related help: :help CTRL-O :help CTRL-I :help jump-motions
To summarize the content of this article:
1. sp to create a horizontal split, vs to create a vertical split
2. vertical res 23, set the window height value, res 23, set the width value
3. open filename, open a file
4. :r read the contents of an external file
5. In the command mode, u is the undo operation, ctrl+r is the back operation