How do I make word motions like w, b, and e treat hyphens or other characters as part of a word?
:set iskeyword+=-
By default, Vim treats hyphens, dots, and many punctuation characters as word boundaries.
399 results for "it at"
:set iskeyword+=-
By default, Vim treats hyphens, dots, and many punctuation characters as word boundaries.
[p
When you copy code from one indentation level and paste it at another, p preserves the original indentation, leaving your code misaligned.
\d \w \s \a \l \u
How it works Vim provides shorthand character classes that save you from writing out full bracket expressions.
:set nrformats+=alpha
By default, and only increment and decrement numbers (decimal, hex, and octal depending on format).
When recording a macro, you can execute another macro inside it by pressing @b (or any register) during the recording.
:%sort u
The :sort u command sorts all lines in the file and removes duplicate lines in one operation.
command-line #command-line #ex-commands #editing #text-manipulation #sort
:ls +
The :ls command (or :buffers) supports filter flags that narrow the buffer list to specific states.
qaq
How it works To clear a macro register, you simply start recording into that register and immediately stop.
:history
:history displays a numbered list of your recently entered Ex commands, giving you a full audit of what you have run in the current session (and across sessions
:wall
When working across multiple files, you often have unsaved changes in several buffers.
/\Cpattern
Vim's ignorecase and smartcase settings change how all searches behave globally.
/foo\|bar
How it works The \ operator in Vim's search pattern works like a logical OR, letting you match any one of several alternatives.
let @a = 'sequence'
How it works Macros recorded with q are stored in registers, but they are lost when you close Vim (unless you have the viminfo or shada file preserving them).
:%Subvert/old{,s}/new{,s}/g
Tim Pope's vim-abolish plugin provides the :Subvert command (aliased as :S), which performs substitutions that automatically preserve case variants and handle p
plugins #plugins #substitution #editing #ex-commands #search
/\cfoo
Vim's \c and \C flags let you force a search to be case-insensitive or case-sensitive on a per-search basis, regardless of your ignorecase and smartcase setting
viw
How it works The command viw selects the word under the cursor in visual mode.
:s/,/,\r/g
In Vim's :substitute command, \r in the replacement string inserts a literal newline — it splits the line at that point.
"1p ... "2p ... "9p
Vim maintains a numbered register history from "1 through "9 that stores your last 9 deletes and changes.
crs / crm / crc / cru
Tim Pope's vim-abolish plugin provides cr (coerce) commands that instantly convert the word under the cursor between common naming conventions.
> and <
How it works In visual mode, you can shift selected lines to the right or left using the > and to indent them or or shifts the selected lines one shiftwidth to