How do I search for a pattern only within specific columns of a line?
When working with columnar data like CSV files, log files, or fixed-width records, you often need to match a pattern only when it appears in a specific column r
category:
search
tags:
#search
#regex
#navigation
#ex-commands
How do I find accidentally repeated words like 'the the' in a document?
When writing or editing text, repeated words like "the the" or "is is" are a common typo that spell checkers often miss.
category:
search
tags:
#search
#editing
#ex-commands
#formatting
How do I search for text that appears after or before a specific pattern without including the pattern in the match?
Vim supports zero-width assertions (lookahead and lookbehind) in its regex engine.
category:
search
tags:
#search
#regex
#advanced-search
#lookahead
#lookbehind
How do I search across files and populate the quickfix list without jumping to the first match?
By default, :vimgrep jumps your cursor to the first match it finds, which can be disorienting when you just want to collect results and browse them on your own
category:
search
tags:
#search
#ex-commands
#buffers
How do I search for a pattern in the current file and navigate results with the quickfix list?
When you need to find all occurrences of a pattern in the current file and jump between them systematically, :vimgrep with % is more powerful than basic / searc
category:
search
tags:
#search
#quickfix
#ex-commands
#navigation
How do I list all lines matching a pattern across the current file and its includes?
The :ilist command searches for a pattern not only in the current buffer but also in files referenced by #include directives (or whatever 'include' is set to).
category:
search
tags:
#search
#ex-commands
#navigation
#editing
How do I use Vim expressions and functions in substitute replacements?
:%s/\<\w\+\>/\=toupper(submatch(0))/g
The \= flag in the replacement part of :substitute tells Vim to evaluate what follows as a Vimscript expression instead of treating it as a literal string.
category:
search
tags:
#search
#substitute
#ex-commands
#editing
#vimscript
How do I repeat the last substitute command preserving its flags?
After running a :s/pattern/replacement/g command, you often need to repeat it on another line or range.
category:
search
tags:
#substitute
#search
#ex-commands
#editing
How do I run an Ex command on all lines between two pattern matches?
Vim's range addressing lets you specify a line range using search patterns instead of explicit line numbers.
category:
search
tags:
#search
#ex-commands
#editing
#command-line
How do I match only part of a search pattern in Vim using \zs and \ze?
Vim's \zs (start of match) and \ze (end of match) atoms let you control which portion of a pattern is treated as the actual match.
category:
search
tags:
#search
#regex
#substitution
#ex-commands
#editing
How do I match only part of a search pattern in Vim using \zs and \ze?
Vim's \zs (start of match) and \ze (end of match) atoms let you define a search pattern but only highlight or operate on a portion of it.
category:
search
tags:
#search
#regex
#substitution
#ex-commands
#editing
How do I search for patterns only at specific line or column positions in Vim?
Vim provides position-matching atoms that constrain where a pattern can match based on line numbers, column positions, or virtual columns.
category:
search
tags:
#search
#regex
#position
#columns
How do I search for a pattern repeated an exact number of times in Vim?
Vim supports counted quantifiers that let you specify exactly how many times a pattern should repeat.
category:
search
tags:
#search
#regex
#quantifiers
#patterns
How do I search using lookahead and lookbehind patterns in Vim?
Vim supports zero-width assertions (lookahead and lookbehind) in its regex engine, allowing you to match text based on what precedes or follows it without inclu
category:
search
tags:
#search
#regex
#patterns
#advanced-search
How do I increment or add to all numbers in a file using Vim substitution?
:%s/\d\+/\=submatch(0)+1/g
Vim's expression replacement (\=) in substitutions lets you perform arithmetic on matched text.
category:
search
tags:
#search
#substitute
#arithmetic
#numbers
How do I swap or rearrange text using captured groups in Vim substitution?
:%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
category:
search
tags:
#search
#substitute
#regex
#captured-groups
How do I search for non-printable or control characters in Vim?
Files sometimes contain hidden control characters that cause subtle bugs.
category:
search
tags:
#search
#special-characters
#hex
#control-characters
How do I search for a pattern that spans multiple lines in Vim?
Vim's regular expressions support multi-line matching through underscore-prefixed atoms.
category:
search
tags:
#search
#regex
#multiline
#patterns
How do I search for multiple alternative patterns at once in Vim?
Vim's search supports alternation with the \ operator, allowing you to find any one of several patterns in a single search.
category:
search
tags:
#search
#regex
#alternation
#patterns
How do I use POSIX character classes in Vim search patterns?
Vim supports POSIX character classes inside bracket expressions, providing a portable and readable way to match categories of characters.
category:
search
tags:
#search
#regex
#character-classes
#posix