What is the difference between word and WORD motions in Vim?
w vs W, b vs B, e vs E
Vim distinguishes between "words" (sequences of keyword characters) and "WORDS" (sequences of non-blank characters).
366 results for ":w"
w vs W, b vs B, e vs E
Vim distinguishes between "words" (sequences of keyword characters) and "WORDS" (sequences of non-blank characters).
:%s/\(\w\+\) \(\w\+\)/\2 \1/g
Vim's substitute command supports captured groups (back-references) using \( and \), allowing you to capture parts of a match and rearrange them in the replacem
<C-w>_ and <C-w>|
When working with multiple splits, you sometimes need to focus on one window temporarily without closing the others.
<C-w>H and <C-w>K
After opening a split you can dynamically reposition windows using H, J, K, and L.
buffers-windows #windows #buffers-windows #navigation #normal-mode
:s/\v(\w+) (\w+)/\2 \1/
Vim's substitute command supports capture groups using \( and \) (or ( and ) in \v very-magic mode).
:s/\(\w\+\) \(\w\+\)/\=submatch(2) . ' ' . submatch(1)/
The submatch(N) function lets you access individual capture groups inside a \= (expression replacement) in a substitution.
:%s/\v<(\w)(\w*)>/\u\1\L\2/g
When you need to normalize casing across headings, labels, or generated docs, editing words one by one is tedious.
<C-w>+ and <C-w>-
The + and - commands increase or decrease the height of the current split window by one line.
<C-w>p
The p command jumps to the previously active window (the last window you were in).
<C-w>r
The r command rotates windows in the current row or column.
:{range}w filename
The :w command with a range and filename saves only the specified lines to a new file.
<C-w>R
Vim provides commands to rotate windows within a row or column, and to swap the current window with another.
<C-w>H
The H command moves the current window to the far left, making it a full-height vertical split.
<C-w>z
Pressing z closes the preview window from any window in the current tab page.
<C-w>]
The ] command opens the definition of the tag under the cursor in a new horizontal split.
{n}<C-w>>
All four window resize mappings accept an optional count prefix that multiplies the resize amount.
<C-w>=
The = (Ctrl+w then =) command resizes all open split windows so they have equal width and height.
:w ++p
Neovim's :w ++p flag automatically creates any missing intermediate directories when writing a file.
:w !cmd
The :w !cmd command sends the buffer's contents as standard input to an external command without modifying the buffer.
<C-w>x
How it works The x command exchanges the current window with the next one.