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.
366 results for ":w"
<C-w>+ / <C-w>- / <C-w>> / <C-w><
Vim provides keyboard shortcuts to resize split windows without reaching for the mouse.
<C-w>h / <C-w>j / <C-w>k / <C-w>l
How it works Vim lets you navigate between split windows using followed by a direction key.
<C-w>> and <C-w><
The > and > increases width by 1 column > increases width by 10 columns maximizes the window width Example With a vertical split, 20> gives the current window 2
<C-w>H / <C-w>J / <C-w>K / <C-w>L
The H, J, K, and L commands move the current window to the far left, bottom, top, or right of the screen respectively, rearranging your entire split layout.
buffers-windows #windows #buffers #navigation #splits #layout
cnoreabbrev w!! w !sudo tee > /dev/null %
When you forget to open a file with elevated privileges, quitting and reopening can break your flow.
command-line #command-line #abbreviations #sudo #write #workflow
<C-w>_
Press _ to maximize the current window's height.
<C-w>|
Press to maximize the current window's width.
<C-w>| and <C-w>_ / <C-w>=
Vim lets you temporarily maximize a split window to full width or full height, and then restore all windows to equal sizes with =.
buffers-windows #windows #splits #navigation #productivity #layout
<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><C-w>
The (Ctrl+w Ctrl+w) command cycles the cursor to the next window in the current tab.
<C-w>v
Press v or use :vsplit to create a vertical split showing the same buffer.
:command! -nargs=* -complete=file W w <args>
When you repeatedly type a long Ex command with filenames, define a user command that keeps the behavior but shortens the keystrokes.
command-line #command-line #ex-commands #completion #workflow
<C-w>s
Press s or use :split to create a horizontal split showing the same buffer.
<C-w>L
Press L (uppercase) to move the current window to the far right using the full height.
nnoremap <leader>s :w<CR>
Use nnoremap for non-recursive normal mode mappings.
<C-w>_ and <C-w>=
When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done.
<C-w>t and <C-w>b
When managing multiple splits, t jumps to the top-left window and b jumps to the bottom-right window.
<C-w>K
Press K (uppercase) to move the current window to the top of the screen using the full width.
:s/\v(\w+)\s+(\w+)/\2 \1/
By using capture groups in a substitute command with very magic mode (\v), you can swap two adjacent words in a single operation.