What does the macro do when you run it?
Do you get any error messages from the shell? or any kind of output read into the file?
I have to admit - I didn't actually test this. Probably should have mentioned that. I just posted the steps I would take in vim in order to record a macro to do what you wanted to do.
So there may be some minor errors in the process in my post. Perhaps a step that isn't quite 100% right.
Looking at the content of your register, yours appears to be missing the double quote " between the [ctrl+r] and [enter] keypresses.
So the output of
:reg e
should look something like:
If that isn't the problem - the only other possible thing I can think of offhand is the newline in the selection we yanked.
Depending on the line-endings in your file (standard unix line-endings vs MSDOS line endings) - that may have an effect on the pasted command in the [ctrl+r]"[enter] part.
If the line-ending is the problem - then during the visual selection part of the macro recording - you could use
v
$
to select to the end of the line then press
h
to move the cursor back one character - to avoid copying the newline character at the end. Then press
y
to yank the line.
So to avoid the possible line-ending problem - the keypresses to record the macro from start to finish (starting on a blank line immediately after the line containing your command) would be:
q
e
[esc]
0
k
w
v
$
h
y
j
:
r
!
[ctrl+r]
"
[enter]
o
[esc]
q
And once again anything in square brackets is a special key, or a key-combo. And we're assuming that all of your example commands that you are selecting and executing are single line commands and that the first character in the line is a $ (which we skip over and avoid).
Then when you run
:reg e
again, it should output something like this:
Re: editing registers
It is possible to edit the contents of a register.
Typically it would involve pasting the content of the register into a blank line in your document, then edit it, before deleting it back to the buffer.
So you could achieve that by using something like
i
[ctrl+r]
e
- to paste the content of register e into a blank line in your document and then make your edits, before visually selecting the edited line and then deleting back to register e using something like
v
$
"
e
d
However, because we've used the [ctrl+r] keybind - when you paste the content of the buffer, the [ctrl+r] character will recall the content of the " register and will expand and include the current content of that register into the dumped macro - which would not be helpful!
So because we've used special keys - it's probably easier to try recording the macro again, until you get it working properly.
If the missing
"
isn't the problem, then the only other thing I can think of is the potential line-ending problem. In which case, the workaround I've posted
should fix that.
If I get time this evening, I'll have a go at recording the macro on my Linux laptop and will check it over.
But I'm pretty certain that this should work though. Like, 99.99% certain!