What are Vim's built-in character class shortcuts for search patterns?
\d \w \s \a \l \u
How it works Vim provides shorthand character classes that save you from writing out full bracket expressions.
\d \w \s \a \l \u
How it works Vim provides shorthand character classes that save you from writing out full bracket expressions.
:retab
How it works The :retab command replaces all tab characters in the current buffer with the appropriate number of spaces, based on your current tabstop and expan
:'<,'>w filename
How it works Vim's :w command can take a range, and when used with a visual selection, it writes only the selected lines to a file.
yiw
How it works The command yiw yanks (copies) the inner word under the cursor.
.\{-}
How it works In most regex engines, ? or +? make quantifiers non-greedy (matching as little as possible).
/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.
]s and [s
How it works When spell checking is enabled in Vim with :set spell, misspelled words are highlighted.
q/
How it works Vim keeps a history of all your search patterns.
gD
How it works Vim provides two built-in commands for jumping to where an identifier is defined, without needing tags or an LSP: gd (lowercase) searches backward
:changes
How it works Vim maintains a change list that records the position of every change you make to a buffer.
/\cpattern
How it works By default, Vim searches are case-sensitive: /Hello will not match hello or HELLO.
:'<,'>!command
How it works Vim can pipe selected text through any external shell command, replacing the selection with the command's output.
:let @a=getline('.')<CR>@a
How it works Instead of recording keystrokes interactively, you can write a sequence of Vim commands as plain text in your buffer and then execute that text as
:jumps
How it works Vim keeps a jump list that records your cursor position every time you make a jump.
:if condition | execute 'normal cmd' | endif
How it works Vim macros can include Ex commands with conditional logic.
:%s/foo/bar/g | %s/baz/qux/g | w
The (bar) character in Vim's command line acts as a command separator, allowing you to chain multiple ex commands together on a single line.
:'<,'>g/pattern/command
How it works The :g (global) command is one of Vim's most powerful features.
qa0f=20i <Esc>20|C= <Esc>lDjq
How it works Aligning text on a delimiter such as = without plugins requires a clever macro technique.
:iabbrev teh the
Vim's abbreviation feature lets you define automatic text replacements that trigger as you type.
( and )
How it works Vim defines a sentence as text ending with .