How do I navigate between spelling errors and fix them in Vim?
]s / [s / z=
Vim has a built-in spell checker that highlights misspelled words and provides correction suggestions — all without plugins.
Search Vim Tricks
Searching...]s / [s / z=
Vim has a built-in spell checker that highlights misspelled words and provides correction suggestions — all without plugins.
dp / do
When reviewing differences between files in Vim's built-in diff mode, dp and do let you selectively apply individual hunks without leaving the editor.
:sort u
The :sort u command sorts all lines in the buffer (or a selected range) alphabetically and removes duplicate lines in a single pass.
:let @q = 'commands'
Macros in Vim are just text stored in named registers.
<C-w>^
Vim tracks the alternate buffer — the last file you were editing before the current one.
* (in visual mode)
In normal mode, searches for the word under the cursor with word-boundary anchors.
"=
The expression register ("=) lets you evaluate any Vim expression and insert its result as text.
P (in visual mode)
When you paste over a visual selection using p (lowercase), Vim replaces the selection with your register contents — but the replaced text overwrites your unn
\v
Vim's default regex mode ("magic") requires backslashes before many special characters: \(, \ , \+, \{.
o (visual mode)
In visual mode, pressing o swaps the cursor between the two ends of the selection (the anchor and the free end).
<C-r><C-r>{register}
In insert mode, {reg} pastes from a register but treats certain bytes as key inputs — so a register containing \n triggers a newline, \x08 triggers backspace,
:keeppatterns {command}
The :keeppatterns modifier runs an Ex command — typically :s, :g, or :v — without modifying @/ (the last search pattern) or the command history.
command-line #ex-commands #search #substitution #command-line #scripting
:wall
When working across multiple files, you often have unsaved changes in several buffers.
:let @q = "dwelp"
Recording macros with q works well for simple sequences, but complex macros with special keys can be hard to get right in one take.
:g/start/,/end/d
The :g (global) command can operate on ranges, not just single lines.
:set iskeyword+=-
By default, Vim treats hyphens, dots, and many punctuation characters as word boundaries.
{count}<C-a> / {count}<C-x>
While increments and decrements a number by 1, you can prefix either with a count to add or subtract a specific amount.
:set matchpairs+=<:>
By default, the % command jumps between (), {}, and [] pairs.
config #navigation #config #matchpairs #editing #normal-mode
:set suffixesadd+=.js,.ts,.jsx,.tsx
The gf (go to file) command opens the file under the cursor, but it fails when the path lacks an extension — common in JavaScript/TypeScript imports like impo
navigation #navigation #config #editing #buffers #file-management
:'<,'>!sort -t',' -k2 -n
Vim does not have a built-in multi-column sort, but you can leverage the external sort command to sort selected lines by any field.
editing #editing #sorting #ex-commands #external-commands #command-line