How do I resize split windows using the keyboard in Vim?
<C-w>+ / <C-w>- / <C-w>> / <C-w><
Vim provides keyboard shortcuts to resize split windows without reaching for the mouse.
<C-w>+ / <C-w>- / <C-w>> / <C-w><
Vim provides keyboard shortcuts to resize split windows without reaching for the mouse.
:tab help
By default, :help opens in a horizontal split, which can feel cramped.
nnoremap <leader>b :b#<CR>
Map b to :b# which switches to the alternate buffer.
<C-w>s
Press s or use :split to create a horizontal split showing the same buffer.
<C-w>v
Press v or use :vsplit to create a vertical split showing the same buffer.
:resize 10
Use :resize 10 or :res 10 to set the window height to 10 lines.
:vertical resize 40
Use :vertical resize 40 to set the window width to 40 columns.
:vsplit filename
Use :vsplit filename or :vsp filename to open a file in a new vertical split to the left of the current window.
<C-w>L
Press L (uppercase) to move the current window to the far right using the full height.
<C-w>K
Press K (uppercase) to move the current window to the top of the screen using the full width.
:split filename
Use :split filename or :sp filename to open a file in a new horizontal split.
<C-w>|
Press to maximize the current window's width.
<C-w>hjkl
Use followed by a direction key: h (left), j (down), k (up), l (right) to move focus between split windows.
<C-w>J
Press J (uppercase) to move the current window to the bottom using the full width.
<C-w>_
Press _ to maximize the current window's height.
:tabmove 0
Use :tabmove N to move the current tab after tab N.
:tabnew
Use :tabnew to open a new empty tab, or :tabnew filename to open a file in a new tab.
:bunload
Use :bunload or :bun to unload the current buffer from memory while keeping it in the buffer list.
:tabclose
Use :tabclose or :tabc to close the current tab.
:tabdo %s/old/new/g
Use :tabdo to execute a command in every tab page.