Vim: Split Screen

Options

" open horisontal split on the bottom of the current buffer
:set splitbellow
:set sb
:set nosplitbellow
:set nosb

" open vertical split to the right of the current buffer
:set splitright
:set spr
:set nosplitright
:set nospr

Vertical split

<ctrl-w> + <ctrl-v>
<ctrl-w> + v
:vsplit
:vs

Horizontal split

<ctrl-w> + <ctrl-s>
ctrl-w + s
:split
:sp

Navigating between split

<ctrl-w> + <ctrl-h/j/k/l/w> (right/down/up/left/cycle)
<ctrl-w> + h/j/k/l/w (right/down/up/left/cycle)

Closing split

<ctrl-w> + c
:close
:clo

Expand vertical split

<ctrl-w> + '>' (expand one line vertical)
:winc >
:vertical res +1

30 + <ctrl-w> + '>' (expand 30 lines vertical)
:30winc >
:vertical res +30

<ctrl-w> + '<' (shrink one line vertical)
:winc <
:vertical res -1

30 + <ctrl-w> + '<' (shrink 30 lines vertical)
:30winc <
:vertical res -30

Expand horizontal split

<ctrl-w> + '+' (expand one line horizontal)
:winc +
:res +1

30 + <ctrl-w> + '+' (expand 30 lines horizontal)
:30winc +
:res +30

<ctrl-w> + '-' (shrink one line horizontal)
:winc -
:res -1

30 + <ctrl-w> + '-' (shrink 30 lines horizontal)
:30winc -
:res -30

Expand maximum, equal

<ctrl-w> + '_' (expand max vertical)
:winc _
<ctrl-w> + '|' (expand max horizontal)
:winc |
<ctrl-w> + '=' (expand equal vertical and horizontal)
:winc =

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *