asyncrun.vim
asyncrun.vim copied to clipboard
how to pipe local text as stdin of ssh command?
let's say I have a range of text selected, and now I want it to be sent over ssh to a remote machine:
I tried both of these, nothing works:
:'<,'>AsyncRun -save=1 -focus=1 -mode=term ssh remotehost "cat - > myfile"
:'<,'>AsyncRun -save=1 -focus=1 -mode=term echo | ssh remotehost "cat - > myfile"
without AsyncRun using vim native redirect it works:
:'<,'>w !ssh remotehost "cat - > myfile"
try to remove -mode=term
When visually selecting a single line, it won't be sent to the command through AsyncRun for some reason. Probably some parsing magic that is using newline as a delimiter. So either select more than one line (last line always disappears, so no worries there), or do the following, worked for me:
:'<,'>AsyncRun -save=1 -focus=1 -mode=term tee | ssh remotehost "cat - > myfile"