I have a shell script on a line alone in a file which I would like to be able to easily execute from vim. Normally I could simply use Y:!^R"
, but this particular script has %
in it, which is expanded to the current filename.
Y:exe '!'.@"
still treats%
as a filenameY:!
=getreg('"')` is passed literally
Ideally whatever solution would be trivial to type, like Y:!^R"
. My current workaround is to run Y:!^R"
and then manually insert a \
before each %
, but this is work the computer should be responsible for.
The command I'm wanting to run is: expr (expr (date --utc +%s) / 86400 - 7) % 15 + 1
in fish
; in bash
that would be expr $(expr $(date --utc +%s) / 86400 - 7) % 15 + 1
.
Is there an easy way to escape special characters in an ex shell command, or treat what is typed strictly literally? I'm sure vim
has this covered, but I've searched a while and don't know how to find it.