How do I write a Vim regex that matches any character including newlines for multi-line pattern matching?
\_.
In Vim's regular expressions, .
2125 results for "i' a'"
\_.
In Vim's regular expressions, .
d2iw
Text objects in Vim accept a count, letting you operate on a span of multiple adjacent text objects in one command.
:set iskeyword+=-
By default, Vim treats hyphens, dots, and many punctuation characters as word boundaries.
:{range}center {width}
Vim has built-in Ex commands for text alignment: :center, :right, and :left.
command-line #ex-commands #formatting #editing #command-line
:set shortmess+=I
The shortmess option is a string of single-character flags that tell Vim which messages to suppress or abbreviate.
:lvimgrep /TODO/j **/* | lopen\<CR>
When you are working in multiple windows, quickfix can become noisy because it is shared globally across the editor session.
<C-\>e
Pressing e on the command line opens a special prompt that lets you type a Vimscript expression.
command-line #command-line #ex-commands #vimscript #insert-mode
vim.iter()
vim.
:topleft split {file}
By default, Vim places horizontal splits below and vertical splits to the right (controlled by splitbelow and splitright).
<C-r><C-r>x
When you press x in insert mode to paste a register, Vim inserts the text "as if you typed it" — meaning autoindent, textwidth, and other insert behaviors can
set wildcharm=<Tab>
By default, pressing in a : mapping inserts a literal tab character rather than triggering wildmenu completion.
:set switchbuf=useopen,usetab
By default, Vim opens a new window (or reloads the buffer in the current window) whenever you navigate to a quickfix entry, tag, or :buffer command — even if
:g/pattern1/s/pattern2/replacement/g
Combining :g with :s lets you apply a substitution using two independent patterns: :g selects which lines to act on, and :s controls what gets replaced within t
:'<,'>norm {commands}
The :normal (or :norm) command lets you execute normal mode keystrokes from the command line.
command-line #editing #ex-commands #normal-mode #productivity #ranges
<C-u>
The (Ctrl+u) command scrolls the window up by half a screen, moving the cursor along with it.
:undojoin
When writing Vim scripts or running multiple Ex commands, each command normally creates a separate undo entry.
:s/pattern/\=expression/
The \= prefix in the replacement field of :s/// tells Vim to evaluate the right-hand side as a Vim script expression and use the result as the replacement text.
\(pattern\)\@=
Vim's regex engine supports zero-width positive lookahead via the \@= operator.
:let @/ = '\V' . escape(expand('<cword>'), '\')
This pattern lets you prepare a precise search target without jumping the cursor or triggering an immediate search motion.
nnoremap <expr> j v:count == 0 ? 'gj' : 'j'
By default, j and k move by physical lines (newline-delimited), which jumps over the entire visual span of a long wrapped line in a single keystroke.