---
# System prepended metadata

title: vim - multiple windows control (viewport)
tags: [vim]

---

# vim - multiple windows control (viewport)

###### tags: `vim`

```
:sp              - will split the Vim window horizontally. 
                   Can be written out entirely as :split .
:vsp             - will split the Vim window vertically. 
                   Can be written out as :vsplit .
:e filename      - edit another file
:split filename  - split window and load another file
ctrl-w up arrow  - move cursor up a window
ctrl-w_          - maximize current window
ctrl-w=          - make all equal size
10 ctrl-w+       - increase window size by 10 lines
:vsplit file     - vertical split
:sview file      - same as split, but readonly
:hide            - close current window
:only            - keep only this window open
:ls              - show current buffers
:b 2             - open buffer #2 in this window

Ctrl-w Ctrl-w    - moves between Vim viewports. (cycle)
Ctrl-w j         - moves one viewport down.
Ctrl-w k         - moves one viewport up.
Ctrl-w h         - moves one viewport to the left.
Ctrl-w l         - moves one viewport to the right.
Ctrl-w =         - tells Vim to resize viewports to be of equal size.
Ctrl-w -         - reduce active viewport by one line.
Ctrl-w +         - increase active viewport by one line.
Ctrl-w q         - will close the active window.
Ctrl-w r         - will rotate windows to the right.
Ctrl-w R         - will rotate windows to the left.
```

Ref:
https://www.linux.com/learn/vim-tips-using-viewports
https://www.cs.oberlin.edu/~kuperman/help/vim/windows.html