How do I execute Ctrl-W window commands from a Vimscript mapping or function without using :normal?
:wincmd {key}
:wincmd is the Ex command equivalent of any keystroke.
25 results for "ctrl w w"
:wincmd {key}
:wincmd is the Ex command equivalent of any keystroke.
:wincmd {cmd}
:wincmd {key} is the Ex command equivalent of every {key} window shortcut.
buffers-windows #buffers-windows #windows #ex-commands #normal-mode
set complete=.,w,b,u,t
The complete option controls which sources Vim scans when you press or for generic keyword completion.
:wincmd
:wincmd {key} executes any {key} window command from the Ex command line or from inside a Vimscript function.
<C-w><C-^>
Press (Ctrl+W followed by Ctrl+6) to open the alternate file in a horizontal split.
<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><C-w>
The (Ctrl+w Ctrl+w) command cycles the cursor to the next window in the current tab.
<C-w>=
The = (Ctrl+w then =) command resizes all open split windows so they have equal width and height.
<C-w>c
The c (Ctrl+w then c) command closes the current window without closing the buffer it contains.
<C-w>T
The T (Ctrl+w then Shift+t) command moves the current split window into a new tab page.
buffers-windows #buffers-windows #windows #tabs #normal-mode
:set nostartofline
By default, many Vim movement commands — gg, G, Ctrl-d, Ctrl-u, Ctrl-f, Ctrl-b, and others — snap the cursor to the first non-blank character of the destina
<C-i>
Every time you make a "jump" — using G, /, %, :tag, , or similar commands — Vim records your position in the jump list.
Write keystrokes in buffer, then "qy$
Instead of recording a macro in real-time (where mistakes mean starting over), you can write the keystrokes as text in a buffer, edit them visually, and then ya
macros #macros #editing #registers #workflow #best-practices
:set splitbelow splitright
How it works By default, Vim opens horizontal splits (:split or :sp) above the current window and vertical splits (:vsplit or :vsp) to the left.
:only
The :only command closes every window in the current tab page except the one your cursor is in.
:let @a="text"
:let @{register}=".
<C-t> / <C-d>
While in Insert mode, you can adjust indentation without switching back to Normal mode.
:let @a = '...'
When a recorded macro contains a typo or needs a small tweak, you can modify it directly via the :let command rather than re-recording the entire sequence.
"ap, edit, "ayy
Vim stores macros in registers, which means you can paste a macro's contents into a buffer, edit it as regular text, and yank it back into the register.
:set eadirection=hor
If you use many splits, automatic equalization can feel disruptive when Vim resizes both height and width after layout changes.