How do I jump to the first macro or #define definition of the word under the cursor?
Vim's [ command jumps to the first definition of the macro or identifier under the cursor, searching from the beginning of the current file and through any file
category:
navigation
tags:
#navigation
#search
#normal-mode
How do I browse and edit my backward search history in a full Vim buffer?
Vim provides three command-line history windows accessible from normal mode: q: for Ex commands, q/ for forward searches, and q? for backward searches.
category:
search
tags:
#search
#command-line
#navigation
How do I paste the contents of a register literally in command-line mode without interpreting special characters?
In command-line mode, {reg} inserts a register's contents — but it processes certain sequences, potentially misinterpreting backslashes, pipe characters, or e
category:
registers
tags:
#registers
#command-line
#search
#editing
How do I insert a literal control character or special key into the command line?
<C-v> (command-line mode)
In command-line mode (after : or /), pressing followed by any key inserts that key literally — bypassing all key notation, mappings, and special interpretatio
category:
command-line
tags:
#command-line
#search
#editing
#insert-mode
How do I join all lines in a file into one, or use a custom separator when joining?
Using \n in the pattern of :substitute matches the newline character at the end of each line, letting you join lines with any separator you choose — something
category:
editing
tags:
#editing
#ex-commands
#search
#formatting
How do I group part of a Vim regex pattern without creating a numbered capture group?
Vim's standard grouping syntax \(.
category:
search
tags:
#search
#patterns
#regex
#advanced
How do I delete all blank and whitespace-only lines from a file in Vim?
The global command :g/^\s$/d removes every line that is empty or contains only whitespace — a common cleanup task when tidying up code, configuration files, o
category:
command-line
tags:
#editing
#ex-commands
#search
#command-line
What is the difference between \n and \r in Vim search patterns versus substitution replacements?
\n in search, \r in replacement
Vim uses \n and \r differently depending on whether they appear in a search pattern or a replacement string, and mixing them up is a common source of confusion.
category:
search
tags:
#search
#substitution
#newline
#patterns
#editing
How do I accept a flagged word as correct for the current session without permanently adding it to my spellfile?
zG marks the word under the cursor as correctly spelled in Vim's internal word list, which exists only for the current session.
category:
config
tags:
#config
#editing
#search
How do I get the current search match index and total count programmatically in Vim?
The searchcount() function returns a dictionary containing the current search state: which match the cursor is on, how many total matches exist, and whether the
category:
search
tags:
#search
#ex-commands
#registers
#completion
How do I reopen the last Telescope picker with my previous search and results still there?
The :Telescope resume command reopens the most recent Telescope picker, restoring the exact query string, filtered results, and cursor position from the last ti
category:
plugins
tags:
#telescope
#search
#navigation
#plugins
#fuzzy-find
How do I highlight multiple different patterns simultaneously using Vim's built-in match commands?
Vim provides three independent match slots — :match, :2match, and :3match — each of which highlights a pattern using a specified highlight group.
category:
search
tags:
#search
#highlighting
#config
#normal-mode
How do I make a single search case-insensitive without changing my global ignorecase setting?
Vim's \c and \C atoms let you override the global ignorecase and smartcase settings on a per-search basis.
category:
search
tags:
#search
#case-sensitivity
#normal-mode
#regex
How do I delete the line immediately following every line that matches a pattern?
Using :g/pattern/+1d you can delete the line that comes right after each line matching a pattern, in one pass.
category:
command-line
tags:
#ex-commands
#editing
#search
#command-line
How do I use case modifiers like \u and \U in a substitution replacement to change capitalization?
Vim's substitute command supports case-modifier escapes in the replacement string: \u uppercases the next character, \U uppercases all text until \E or end of r
category:
search
tags:
#search
#editing
#substitute
#regex
#ex-commands
How do I force a case-sensitive search in Vim even when ignorecase is enabled?
Appending \C anywhere in a search pattern forces the entire search to be case-sensitive, regardless of whether ignorecase or smartcase is set.
category:
search
tags:
#search
#case-sensitive
#ignorecase
#smartcase
#normal-mode
How do I configure Vim's :grep command to use a faster external search tool like ripgrep or ag?
:set grepprg={cmd} grepformat={fmt}
Vim's :grep command delegates to an external tool defined by grepprg, then parses the output according to grepformat to populate the quickfix list.
category:
search
tags:
#search
#ex-commands
#config
#buffers
How do I apply the last spelling correction to all other identical misspellings in the file?
After correcting a misspelled word with z= (or 1z= for the first suggestion), run :spellrepall to apply that same correction to every other occurrence of the id
category:
editing
tags:
#editing
#search
How do I match a pattern only when preceded or followed by another pattern using zero-width assertions?
Vim's regex engine supports zero-width lookahead and lookbehind assertions — \@= and \@<= — which let you match text based on surrounding context without in
category:
search
tags:
#search
#regex
#advanced
#patterns
#substitution
How do I extract regex capture groups from a string in Vimscript?
matchlist({str}, {pattern}) runs a regex match and returns a list of all captured groups, making it the idiomatic way to extract structured data from strings in
category:
macros
tags:
#vimscript
#macros
#ex-commands
#search