I have a regular expression like this:
:%s/pattern/ pattern/gc
As you can see in the replacement text I want eight whitespace characters initially. I don’t want to type eight white spaces every time. Is there a more elegant way of doing this?
If you’re after conserving keystrokes, you can initialize a named register with the replacement text:
Then, when building your substitution command, you insert the register contents via CTRL-R + {register-name}:
For further simplification, I have referred to the search pattern in the replacement string via
&.