How do I customize what Vim considers a 'word' for motions and text objects?
:setlocal iskeyword+=-
The iskeyword option defines which characters are part of a "word" for motions like w, b, e, , and text objects like iw.
1029 results for "i" a""
:setlocal iskeyword+=-
The iskeyword option defines which characters are part of a "word" for motions like w, b, e, , and text objects like iw.
o
The o command opens a new line below the current line and places you in insert mode, ready to type.
<C-w>n
n creates a new empty buffer and opens it in a horizontal split above the current window.
<C-w>}
How it works The } command opens a preview window showing the tag definition of the word under your cursor.
"/
Vim stores the last search pattern in the special / register.
]c
In diff mode, ]c jumps to the next change hunk and [c jumps to the previous one.
:'<,'>s/old/new/g
After making a visual selection, you can run a substitute command that only affects the selected text.
10@a
The 10@a command replays the macro recorded in register a exactly 10 times.
:put a ... edit ... "ayy
Recorded macros are stored as plain text in registers, but editing them by re-recording is tedious for complex sequences.
qaqqa{actions}@aq@a
A recursive macro is a macro that calls itself at the end of its recording.
<C-w>r
The r command rotates windows in the current row or column.
`.
The ` .
di(
The di( command deletes everything inside the nearest pair of parentheses without removing the parentheses themselves.
<C-v>$
In visual block mode, pressing $ extends the selection to the end of every line, even when lines have different lengths.
{count}@{register}
Prefix any macro execution with a count to repeat it that many times in a single command.
:set list
The :set list command makes invisible characters visible by displaying them as special symbols.
:let @/ = "pattern"
Assigning a string directly to the search register @/ with :let causes Vim to highlight all matches (if hlsearch is enabled) without performing a search or movi
/[\x00-\x1f]
Files sometimes contain hidden control characters that cause subtle bugs.
:%s/pattern//gn
The n flag on the substitute command makes it report the match count without actually performing any replacement.
mA to set, 'A to jump
Uppercase marks (A–Z) are global marks — they persist across files and Vim sessions.