Vim Windows and Tabs

Managing windows and tabs

Split Windows

:sp # horizontal split
:vsp # vertical split
:sp filename # split and open file
Ctrl + w s # horizontal split (normal mode)
Ctrl + w v # vertical split (normal mode)

Navigate Windows

Ctrl + w h # move to left window
Ctrl + w j # move to window below
Ctrl + w k # move to window above
Ctrl + w l # move to right window
Ctrl + w w # cycle through windows

Resize Windows

Ctrl + w = # make windows equal size
Ctrl + w + # increase height
Ctrl + w - # decrease height
Ctrl + w > # increase width
Ctrl + w < # decrease width

Close Windows

:q # close current window
Ctrl + w q # close current window
:only # close all windows except current

Tabs

:tabnew # open new tab
:tabnew filename # open file in new tab
gt # go to next tab
gT # go to previous tab
:tabclose # close current tab