Working with multiple files or views requires switching buffers. Split windows provide simultaneous visibility of multiple files or different parts of the same file.
Vim supports horizontal (:split) and vertical (:vsplit) window splits for simultaneous file viewing. Window commands enable navigation and resizing.
Split commands:
| Command | Action |
|---|---|
:split or :sp | Horizontal split (top/bottom) |
:vsplit or :vsp | Vertical split (left/right) |
:split <file> | Split and open file |
<C-w><dir> | Switch focus (dir = h,j,k,l or arrows) |
<C-w>_ | Maximize horizontal split |
| ` | ` |
<C-w>+ | Grow split by 1 line |
<C-w>- | Shrink split by 1 line |
- Each split has its own buffer
- Splits share registers and global settings
:hidecloses current split:onlycloses all other splits
- Resize mode:
<C-w>=equals all split sizes - Tab-based workflow is modern alternative to splits
:help splithas comprehensive documentation
- Block Selection — Shares window commands
- Survival Commands — Buffer commands apply in splits
- Visual Selection — Works across splits
- Vim Modes — All commands work in split windows