How do I search for the word under my cursor across all project files using Telescope?
require('telescope.builtin').grep_string()
Telescope's grepstring() function performs a project-wide search for the exact word currently under the cursor, displaying live-previewed results in an interact
category:
plugins
tags:
#plugins
#search
#navigation
#telescope
How do I compile a custom word list into a Vim spell file for faster spell checking?
:mkspell ~/.vim/spell/en.utf-8.add
When you add words to your personal spell file with zg, Vim writes them to a plain-text .
category:
config
tags:
#config
#search
How do I replace only the current match and then stop when doing an interactive substitution in Vim?
l (in :%s///gc confirm prompt)
When running an interactive substitution with the c flag (e.
category:
editing
tags:
#search
#editing
#substitution
#ex-commands
#normal-mode
How do I convert text to title case in Vim using a substitution command?
Vim's substitution engine supports case-modifier sequences in the replacement string, making it possible to convert text to title case in a single command.
category:
search
tags:
#search
#substitution
#regex
#editing
#case
#formatting
How do I refer to all files in the argument list at once in an Ex command?
The ## special token expands to the names of all files currently in Vim's argument list.
category:
command-line
tags:
#command-line
#buffers
#ex-commands
#search
How do I restrict a substitution to the range between two named marks?
Named marks can serve as range endpoints for any Ex command, including :substitute.
category:
search
tags:
#search
#marks
#substitution
#ex-commands
#editing
How do I jump directly to the first or last entry in the quickfix list?
:cfirst and :clast jump directly to the first or last entry in the quickfix list, skipping all intermediate results.
category:
command-line
tags:
#ex-commands
#navigation
#search
How do I force a case-insensitive substitution without changing the global ignorecase setting?
:%s/pattern/replacement/ig
The :s substitute command accepts /i and /I flags that override your global ignorecase and smartcase settings for that single substitution, letting you choose c
category:
search
tags:
#search
#editing
#ex-commands
#normal-mode
How do I highlight all occurrences of a yanked word without typing a search pattern?
After yanking text, you can promote it directly to the search register with :let @/ = @".
category:
registers
tags:
#registers
#search
#hlsearch
#normal-mode
How do I rearrange or transform captured groups in a substitution using Vimscript?
:s/\(\w\+\) \(\w\+\)/\=submatch(2) . ' ' . submatch(1)/
The submatch(N) function lets you access individual capture groups inside a \= (expression replacement) in a substitution.
category:
search
tags:
#search
#editing
#ex-commands
#registers
How do I use a pattern-based range with an offset to operate on lines relative to a search match?
:/pattern/+N and :/pattern/-N
Vim's Ex command ranges can use search patterns as line addresses, and those addresses can include a numeric offset (+N or -N) to target lines relative to the m
category:
command-line
tags:
#ex-commands
#search
#command-line
#editing
How do I filter the quickfix list to only show entries matching a pattern?
Vim ships with an optional built-in package called cfilter that adds :Cfilter and :Lfilter commands for narrowing down quickfix and location list entries by pat
category:
command-line
tags:
#ex-commands
#quickfix
#search
#command-line
Why doesn't \n insert a newline in a :s replacement, and what should I use instead?
In Vim substitutions, \n and \r behave differently depending on whether they appear in the search pattern or the replacement string — a common gotcha that sur
category:
search
tags:
#search
#editing
#ex-commands
#normal-mode
How do I configure Vim's :grep command to use ripgrep for faster project-wide searching?
:set grepprg=rg\ --vimgrep\ --smart-case
By default, Vim's :grep command calls the system grep.
category:
config
tags:
#search
#ex-commands
#config
#quickfix
#advanced
How do I match text only when it is preceded by a specific pattern in Vim regex?
:%s/\(prefix\)\@<=target/replacement/g
Vim's \@<= is a zero-width look-behind assertion.
category:
search
tags:
#search
#regex
#substitution
#advanced
How do I write a search pattern that requires two conditions to match at the same position in Vim?
Vim's \& operator is the AND combinator in a search pattern.
category:
search
tags:
#search
#regex
#ex-commands
#normal-mode
How do I customize which patterns Vim considers a definition for [d and ]d jump commands?
Vim's [d, ]d, [D, and ]D commands search for the "definition" of the keyword under the cursor.
category:
config
tags:
#config
#navigation
#search
#tags
#ex-commands
How do I jump to a tag in Vim and automatically choose if there is only one match?
Vim's :tjump is the smarter sibling of :tag and :tselect.
category:
navigation
tags:
#navigation
#tags
#ctags
#search
How do I use \zs and \ze to define the exact boundaries of a regex match in Vim?
Vim's \zs ("match start") and \ze ("match end") atoms let you narrow the actual match region within a broader pattern context.
category:
search
tags:
#search
#regex
#substitution
#patterns
#advanced
How do I force a search to be case-sensitive even when ignorecase is enabled?
Adding \C anywhere in a search pattern forces case-sensitive matching for that search, overriding the global ignorecase setting.
category:
search
tags:
#search
#normal-mode
#case