Thanks for this implementation!
I made this little script to use "any" editor on the local side: rmate-server
How it works:
socat listens on the configred TCP port and forks a subprocess per incoming connection, re-executing this script with --handle-connection so stdin/stdout are wired directly to the socket.
- On connect, the handler sends a greeting line and then reads the rmate protocol stream. Each
open command carries headers (token, display-name, selection, data length) followed by the raw file bytes, which are written to a temp file under a per-session directory.
- The temp file is opened in the configured editor asynchronously. A background subshell runs
inotifywait -e close_write in a loop on that file; whenever the editor saves it, the updated contents are streamed back to the remote over the same socket (save response).
- When the connection closes (EOF on stdin), an
EXIT trap kills all watchers, sends close notifications for each open file, and removes the session temp directory.
Thanks for this implementation!
I made this little script to use "any" editor on the local side: rmate-server
How it works:
socatlistens on the configred TCP port and forks a subprocess per incoming connection, re-executing this script with--handle-connectionso stdin/stdout are wired directly to the socket.opencommand carries headers (token, display-name, selection, data length) followed by the raw file bytes, which are written to a temp file under a per-session directory.inotifywait -e close_writein a loop on that file; whenever the editor saves it, the updated contents are streamed back to the remote over the same socket (saveresponse).EXITtrap kills all watchers, sendsclosenotifications for each open file, and removes the session temp directory.