How do you run a command in every tab?
:tabdo %s/old/new/g
Use :tabdo to execute a command in every tab page.
90 results for "%s/old/new/g"
:tabdo %s/old/new/g
Use :tabdo to execute a command in every tab page.
:bufdo %s/old/new/g
Use :bufdo to execute a command in every buffer.
:%s/old/new/g
The :%s/old/new/g command replaces all occurrences of old with new across every line in the file.
:%S/old/new/g (vim-abolish)
vim-abolish by Tim Pope provides :%S (Subvert), a substitute command that preserves the case pattern of the original text.
:cdo s/old/new/g
The :cdo command executes a command on every entry in the quickfix list.
:%Subvert/old{,s}/new{,s}/g
Tim Pope's vim-abolish plugin provides the :Subvert command (aliased as :S), which performs substitutions that automatically preserve case variants and handle p
plugins #plugins #substitution #editing #ex-commands #search
:[{,]}s/old/new/g
By using the range [{,]}, you can limit a substitute command to the lines between the enclosing braces — effectively the current function or block.
:s/old/new/g
The :s/old/new/g command replaces all occurrences of old with new on the current line only.
:%s/\v(old)/\=toupper(submatch(0)[0]).tolower(submatch(0)[1:])/g
Standard substitutions don't preserve the original case of matched text.
:cdo s/old/new/g | update
The :cdo command executes a given command on every entry in the quickfix list.
command-line #command-line #quickfix #batch-editing #search #multi-file
:keeppattern %s/old/new/g
When you run a :s or :%s substitute command, Vim updates the search register (@/) with the substitution pattern.
command-line #ex-commands #search #editing #registers #substitute
:argdo %s/old/new/g | update
The :argdo command runs an Ex command on every file in the argument list (the files you opened Vim with, or added via :argadd).
:keeppattern s/old/new/g
When you run a :s or :g command, Vim updates the search register (@/) with the pattern you used.
:keeppatterns %s/old/new/g
The :keeppatterns modifier runs any Ex command without modifying Vim's last search pattern (stored in @/).
command-line #search #ex-commands #command-line #substitute #registers
:'a,'b s/old/new/g
Marks can be used as range specifiers in any Ex command.
command-line #marks #command-line #ex-commands #ranges #editing
qa:s/old/new/g<CR>jq
How it works You can combine Ex commands like :s (substitute) with macro recording to create powerful repeatable find-and-replace operations that go beyond what
:%s/\<old\>/new/g
Wrapping your search pattern in \ word boundary anchors ensures that Vim only matches the exact whole word, preventing accidental replacements inside longer wor
:%Subvert/old/new/g
The vim-abolish plugin by Tim Pope provides the :Subvert command (abbreviated :S), which performs search-and-replace operations that automatically handle every
:let @a = substitute(@a, 'old', 'new', 'g')
After recording a macro or yanking text into a named register, you may need to tweak it — fix a typo in a recorded macro, change a variable name in yanked tex
:let @q = substitute(@q, "old", "new", "g")
Vim macros are stored as plain text in registers, which means you can inspect and modify them like any other string.