When answering Remove EOL spaces of selection only if there are, I noticed that my answer is not really satisfying: the pattern \ \+$ has to be typed twice:
- once for searching with
:g - once for replacing with
:s
First thought was to simply use g/\(\ \+$\)/s/\1//g but this gives me an error about an invalid back reference (E65).
Is there a way to re-use the pattern used in :g for the [cmd] being executed?
You don’t need
\1:is same as: