randy3k / RemoteSubl

Use rmate with Sublime Text, an improved fork of rsub.
327 stars 20 forks source link

Execute on server or get remote filepath #16

Closed antoinezambelli closed 4 years ago

antoinezambelli commented 4 years ago

Hi!

I'm using this with a Linux server and Windows local. I'm hoping to actually execute the file on the server by doing a ctrl+b command on local. Is there any way to get the remote filepath? Is it stored somewhere?

If there is, then I can make a custom build command that uses plink to send a plink.exe user@host "python /path/on/remote/my_file.py" command.

For now I can hardcode the /path/on/remote/my_file.py into the build command, but if I can get the remote filepath from somewhere, then I can make that dynamic (write it to a file and the build command reads the file).

I realize one way to essentially achieve this is the make a build system that does plink.exe user@host < /path/to/local/my_file.py "cat > ~/path/to/temp/remote/my_file.py && python ~/path/to/temp/remote/my_file.py" but that seems messy.

randy3k commented 4 years ago

It's stored in the global variable FIlES. You might need to write a plug-in to achieve it.

antoinezambelli commented 4 years ago

I found a hack to do what I want by defining a build system to be:

{
    "shell_cmd": "plink.exe user@host -pw password -no-antispoof find . -name \"$file_base_name*\" -exec python {} \\;"
}

Essentially, finding the file name I'm trying to run and feeding that into python, obviously breaks with non-unique filenames.

This errors on plink.exe because it needs admin privileges, but if I open ST3 as admin, then rmate doesn't open the file. Do you know how to get rmate to open the file in the admin instance of ST3?