:vsplit
(short form: :vs
) split the Vim viewport vertically. :30vs
splits the viewport, making the new window 30 characters wide. Once
I am using the below commands for this:
set lines=50 " For increasing the height to 50 lines (vertical)
set columns=200 " For increasing the width to 200 columns (horizontal)
Along the same lines, I use the following in my .vimrc
to let me move through the splits, automatically expanding the one I'm moving to to its full size and shrinking all the rest to their minimum height or width:
" Switch between window splits using big J or K and expand the split to its
" full size.
"
" Move vertically in the window through the horizontal splits...
map <C-J> <C-w>j<C-w>_
map <C-K> <C-w>k<C-w>_
" Move horizontally in the window through the vertical splits...
map <C-H> <C-w>h<C-w>\|
map <C-L> <C-w>l<C-w>\|
I am using numbers to resize by mapping the following in .vimrc
nmap 7 :res +2<CR> " increase pane by 2
nmap 8 :res -2<CR> " decrease pane by 2
nmap 9 :vertical res +2<CR> " vertical increase pane by 2
nmap 0 :vertical res -2<CR> " vertical decrease pane by 2
CTRL-W >
and
CTRL-W <
to make the window wider or narrower.
And Ctr-W =
will make them equal
In case you need HORIZONTAL SPLIT resize as well:
The command is the same for all splits, just the parameter changes:
-
+
instead of <
>
Examples:
Decrease horizontal size by 10 columns
:10winc -
Increase horizontal size by 30 columns
:30winc +
or within normal mode:
Horizontal splits
10 CTRL+w -
30 CTRL+w +
Vertical splits
10 CTRL+w < (decrease)
30 CTRL+w > (increase)