How do I find which syntax highlighting rules are slowing down Vim?
:syntime on
When Vim feels sluggish while editing files with complex syntax highlighting, :syntime lets you profile exactly which syntax rules are consuming the most time.
640 results for "/pattern"
:syntime on
When Vim feels sluggish while editing files with complex syntax highlighting, :syntime lets you profile exactly which syntax rules are consuming the most time.
set hlsearch
Use set hlsearch to highlight all matches of the last search pattern.
:lockmarks keepjumps keeppatterns %s/foo/bar/ge
Large substitutions are efficient, but they often leave side effects: your last search changes, your jumplist gets noisy, and marks can shift in ways that break
command-line #command-line #editing #substitution #navigation
:Subvert
The vim-abolish plugin's :Subvert command (abbreviated :S) substitutes a word across all its case variants simultaneously.
:set grepprg=rg\ --vimgrep\ --smart-case
By default, Vim's :grep command calls the system grep.
set incsearch
With set incsearch, Vim shows search matches as you type the pattern.
:%s/\<old\>/new/g
Wrapping your search pattern in \ word boundary anchors ensures that Vim only matches the exact whole word, preventing accidental replacements inside longer wor
:g/./norm @q
Combining the :global command with :normal lets you run a macro on every non-blank line in one shot.
\V
Vim's default search mode gives special meaning to characters like .
>gv
Normally, pressing > in visual mode indents the selection but exits visual mode, requiring you to press gv to reselect.
cgn...{text}<Esc>.
The cgn + .
:[range]normal @a
The :[range]normal @a command runs a recorded macro against every line in a given range.
macros #macros #registers #ex-commands #normal-mode #advanced
[I
How it works The [I command searches the current file (and included files) for the word under the cursor and displays a list of all matching lines with their li
highlight TrailingWhitespace ctermbg=red and match TrailingWhitespace /\s\+$/
How it works Vim's highlight and match commands let you create custom visual indicators.
:cabbrev tn tabnew
Command-line abbreviations with cabbrev let you create short aliases for frequently used Ex commands.
command-line #command-line #abbreviation #shortcuts #productivity
:doautocmd User MyEvent
Vim's User event type lets you define custom events that fire on demand.
:%s/\(\w\+\) \(\w\+\)/\2 \1/g
Vim's substitute command supports captured groups (back-references) using \( and \), allowing you to capture parts of a match and rearrange them in the replacem
g*
The g command searches forward for the text under the cursor without adding word boundary anchors.
search #search #navigation #normal-mode #motions #productivity
/foo\@<!bar
Vim regex supports zero-width assertions, so you can match text based on context without consuming the context itself.
:s/\%#\k\+/REPL/
Most substitutions operate on broad ranges, but sometimes you want a precise edit anchored to where your cursor is right now.