How do I yank text from the cursor to the next occurrence of a pattern without entering visual mode?
y/{pattern}<CR>
Any operator in Vim can take a search motion as its argument.
640 results for "/pattern"
y/{pattern}<CR>
Any operator in Vim can take a search motion as its argument.
\@!
In Vim's regex engine, \@! is the negative lookahead assertion.
:filter /pattern/ command
The :filter command restricts the output of another Ex command to only lines matching a given pattern.
/\v pattern
The \v flag enables "very magic" mode in Vim regex, where most special characters work like standard regular expressions without needing backslashes.
:autocmd Event pattern command
Autocommands let you execute commands automatically in response to events like opening a file, saving, or changing buffers.
:vimgrep /pattern/ **/*.ext | copen
The :vimgrep command searches for a regex pattern across multiple files and populates the quickfix list with every match.
search #search #quickfix #ex-commands #navigation #productivity #grep
:call matchadd('Search', 'pattern')
The matchadd() function lets you add persistent highlights to patterns without affecting the search register.
/\_.pattern
The \.
/pattern\{-}
The \{-} quantifier in Vim regex matches as few characters as possible, unlike which matches as many as possible (greedy).
/pattern
The /pattern command searches forward through the file for the given pattern.
\C in search pattern
Adding \C anywhere in a search pattern forces case-sensitive matching for that search, overriding the global ignorecase setting.
:g/pattern/normal @a
The :g (global) command combined with :normal @a lets you execute a recorded macro only on lines matching a pattern.
macros #macros #ex-commands #global-command #editing #automation
/pattern\@<=match
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
:g/pattern/.-1,.+1d
The :g (global) command normally operates on lines that match a pattern.
/pattern\c
Vim's \c and \C atoms let you override the global ignorecase and smartcase settings on a per-search basis.
\@<= and \@=
Vim's regex engine supports zero-width lookahead and lookbehind assertions using the \@ atom.
:%s/pattern/replacement/gn
When you are about to run a broad substitution, it is often safer to measure impact first.
command-line #command-line #ex-commands #substitution #search
:s/pattern/replace/flags
The substitute command supports several flags that modify its behavior.
/pattern\C
Appending \C anywhere in a search pattern forces the entire search to be case-sensitive, regardless of whether ignorecase or smartcase is set.
search #search #case-sensitive #ignorecase #smartcase #normal-mode
\%(pattern\)\@=
Vim's lookahead assertion \@= confirms that the current position is followed by a pattern — without including those characters in the match.