One easy way to save any kind of action is to record it as a macro. These are stored in the named registers,
"z, and with the default
'viminfo' setting, these registers will be saved to the .viminfo file and thus persisted across Vim restarts. (See
So for example, the following series of keystrokes would store your first example substitution command in the
<CR> designates a press of the Return key.)
You can then replay this macro by pressing
@a from Normal mode.
You could of course store your example entire sequence of substitutions in a single macro if they are always to be run in succession.
So long as your
'viminfo' is set up to save registers, then this macro will persist until you (or a poorly written script) overwrites this register, so although technically your commands could be saved forever, this method is better suited for storing things for a finite and reasonably short-lived period of time.