You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:s/old/new/ — replace first match in the current cell.
:s/old/new/g — replace all matches in the current cell.
:%s/old/new/g — replace all matches in every cell of the sheet.
'<,'>s/old/new/g — replace within the last visual range (depends on gv-style range tracking).
c flag — confirm each replacement interactively.
Open questions
Regex or literal? Vim defaults to magic regex. Suggest starting with literal substrings + later adding \V / regex variant. Less footgun, easier to test.
Formulas. Replace inside raw (so =A1+1 → =A1+2 for :s/1/2/g)? Probably yes, with the dep graph re-registering after each replacement. But — match what users expect for :%s/A1/A2/g carefully; this is not the same as a "rename column" operation and we shouldn't pretend it is.
Undo granularity. One undo entry per :s invocation, not per cell. Needs a begin_batch / end_batch wrapper around the existing undo stack.
Iteration order. Row-major. Document it.
Confirm prompt UX. A modal-ish prompt at the bottom: replace with new (y/n/a/q/l), mirroring vim.
Out of scope
Visual-block-scoped replace.
:s inside a recorded macro (depends on the macros RFC).
Goals
:s/old/new/— replace first match in the current cell.:s/old/new/g— replace all matches in the current cell.:%s/old/new/g— replace all matches in every cell of the sheet.'<,'>s/old/new/g— replace within the last visual range (depends ongv-style range tracking).cflag — confirm each replacement interactively.Open questions
\V/ regex variant. Less footgun, easier to test.raw(so=A1+1→=A1+2for:s/1/2/g)? Probably yes, with the dep graph re-registering after each replacement. But — match what users expect for:%s/A1/A2/gcarefully; this is not the same as a "rename column" operation and we shouldn't pretend it is.:sinvocation, not per cell. Needs abegin_batch/end_batchwrapper around the existing undo stack.replace with new (y/n/a/q/l), mirroring vim.Out of scope
:sinside a recorded macro (depends on the macros RFC).