VIM viewports — splitted window
Vim seams to be simple and without many features. But it’s just false first impression. One of “hidden” feature is splitted window.
By default new viewport shows file visible in current viewport.
Splitting:
:sp
,:split
— splits window horizontaly:sp filename
,:split filename
— splits window horizontaly and opensfilename
:12 sp
,:12 split
— splits window horizontaly with heigth =12 lines
:vsp
,:vsplit
— splits verticaly:vsp filename
,:vsplit filename
— splits verticaly and opensfilename
:12 vsp
,:12 vsplit
— splits verticaly with width =12 chars
Working with splitted view:
Ctrl-w Ctrl-w
— moves between Vim viewports.Ctrl-w j
— moves focus one viewport down.Ctrl-w k
— moves focus one viewport up.Ctrl-w h
— moves focus one viewport to the left.Ctrl-w l
— moves focus one viewport to the right.Ctrl-w =
— tells Vim to resize viewports to be of equal size.Ctrl-w –
— shorten current viewport by one line.Ctrl-w +
— enlarge current viewport by one line.Ctrl-w >
— widen current viewport by one char.Ctrl-w <
— decrease width of current viewport by one char.Ctrl-w q
— will close the active viewport.Ctrl-w r
— will rotate all viewports to the right / down.Ctrl-w R
— will rotate all viewports to the left / up.