Reputation: 700
The command looks like this
autocmd! BufWritePost <buffer> mark s | $r ! ruby % | sed 's/^/\#=> /' | 's
It will append the output and move cursor to the original position, before appending.
This is the error I got:
Error detected while processing BufWritePost Auto commands for "<buffer=1>":
E485: Can't read file /var/folders/fw/045tt2q10zv1qkbfbw73y8c80000gn/T/vCDqw9b/7
If remove | 's
at the end of line, it works fine, but no returning to the marked s
position.
Upvotes: 2
Views: 413
Reputation: 172738
There are two problems:
:read ! ...
command cannot be concatenated with other Vim commands; it treats all following text as the command to execute. This causes the shell error. See :help :bar
. You can fix this by wrapping with :execute
.'s
is a normal mode command; to use it in a command-line, you need to prefix the :normal
Ex command.autocmd! BufWritePost <buffer> mark s | execute "$r ! ruby % | sed 's/^/\#=> /' " | normal! 's
Upvotes: 3