139 results for
"S substitute line"
How do I run the same Ex command in every open window at once?
:windo {cmd} executes an Ex command in every window in the current tab page, cycling through each one and applying the command before returning focus to the ori
category:
buffers-windows
tags:
#windows
#buffers
#ex-commands
#buffers-windows
How do I use a VimScript expression as the replacement in a substitution?
:s/pattern/\=expression/g
Prefixing the replacement string with \= in a :substitute command tells Vim to evaluate the rest as a VimScript expression rather than literal text.
category:
search
tags:
#search
#ex-commands
#editing
#normal-mode
How do I select or operate on the entire buffer as a text object?
While Vim doesn't have a built-in "entire buffer" text object, the ggVG sequence achieves it: go to the first line, enter line-wise visual mode, then select to
category:
editing
tags:
#editing
#text-objects
#visual-mode
#normal-mode
How do I use marks to define a range for Ex commands?
Marks can be used as range specifiers in any Ex command.
category:
command-line
tags:
#marks
#command-line
#ex-commands
#ranges
#editing
How do I use a Vim expression to dynamically compute substitution replacement text?
The \= prefix in the replacement field of :s/// tells Vim to evaluate the right-hand side as a Vim script expression and use the result as the replacement text.
category:
search
tags:
#search
#substitution
#ex-commands
How do I quickly create an Ex command range spanning the next N lines using a count before the colon?
Typing a count before : in normal mode automatically fills in a line range in the command line.
category:
command-line
tags:
#command-line
#ex-commands
#ranges
#normal-mode
How do I change the case of text using operators and motions?
gU{motion} / gu{motion} / g~{motion}
Vim has three case operators that work with any motion or text object: gU for uppercase, gu for lowercase, and g~ for toggle case.
category:
editing
tags:
#editing
#case
#operators
#text-objects
#normal-mode
How do I count the number of matches for a search pattern?
The :%s/pattern//gn command counts how many times a pattern appears in the file without making any changes.
category:
search
tags:
#search
#ex-commands
#editing
How do I write a non-greedy (lazy) quantifier in Vim's search regex?
In Vim's regex engine, \{-} is the non-greedy (lazy) quantifier — it matches as few characters as possible, unlike .
category:
search
tags:
#search
#regex
#patterns
#substitution
How do I search and replace with confirmation for each match?
Adding the c flag to a substitute command makes Vim pause at every match and ask you whether to replace it.
category:
search
tags:
#search
#substitution
#ex-commands
#editing
How do I use search patterns as line ranges in Ex commands to operate on a block of text?
Instead of specifying line numbers for Ex command ranges, you can use search patterns.
category:
command-line
tags:
#ex-commands
#editing
#search
#ranges
#command-line
How do I restrict a Vim search to match only within a specific range of line numbers?
Vim's \%>{lnum}l and \%5l — matches only at positions after line 5 (i.
category:
search
tags:
#search
#regex
#navigation
#ex-commands
How do I wrap text with a custom HTML tag using vim-surround?
vim-surround's ysst sequence lets you wrap a text object with an arbitrary HTML or XML tag and prompts you to type the tag name.
category:
plugins
tags:
#plugins
#vim-surround
#html
#text-objects
How do I write a Vim search pattern that matches text at or between mark positions?
Vim's \%'m regex atom matches the exact position of mark m in a search pattern.
category:
search
tags:
#search
#marks
#navigation
#ex-commands
#normal-mode
How do I search for a pattern and land on a specific line offset from the match?
/pattern/+N or /pattern/-N
Vim's search command accepts an offset that places your cursor on a line relative to the match.
category:
navigation
tags:
#navigation
#search
#offset
#motions
How do I edit a recorded macro by treating it as plain text?
When you record a macro and realize it has a mistake, the easiest fix is to paste the macro's keystrokes as text, edit them, and yank the corrected version back
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I copy the contents of one register into another register?
Vim's :let command lets you read and write register contents as strings, making it possible to copy, combine, or modify register values without ever leaving the
category:
registers
tags:
#registers
#ex-commands
#editing
#normal-mode
How do I use a register value as the replacement string in a substitution?
How it works In Vim's substitute command, the replacement string can be a Vimscript expression when prefixed with \=.
category:
registers
tags:
#registers
#search
#ex-commands
#editing
How do I uppercase or capitalize matched text inside a Vim substitution?
Vim's substitute command supports special case-conversion sequences in the replacement string, letting you transform matched text to upper or lower case without
category:
editing
tags:
#editing
#search
#ex-commands
#normal-mode
How do I save my last Ex command into a register so I can replay it as a macro?
The : register always holds the last Ex command you ran.
category:
macros
tags:
#macros
#registers
#ex-commands
#workflow