Ok, I have rather simple question: How can one bind vim command/hotkey to execute some complicated shell-script?
E.g. I want to optimize base64-inlined images inside css files. I know, that in shell it would be something like:
echo `selection` > /tmp/img.png.b64
base64 -d /tmp/img.png.b64 > /tmp/img.png
optipng -o7 /tmp/img.png
base64 -w 0 /tmp/img.png > `selection`
I want to put selection into the script and then get result of script execution and replace selected content with that result.
I see the workflow as selecting base64 part in visual block mode and type e.g. :'<,'>optipng or press some hotkey.
The question is how to setup vim to do that.