Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to pipe local text as stdin of ssh command? #247

Open
pinggit opened this issue May 15, 2022 · 2 comments
Open

how to pipe local text as stdin of ssh command? #247

pinggit opened this issue May 15, 2022 · 2 comments

Comments

@pinggit
Copy link

pinggit commented May 15, 2022

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"

@skywind3000
Copy link
Owner

try to remove -mode=term

@nabaco
Copy link

nabaco commented Mar 20, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants