Skip to content

Use any editor on the local side #89

@pricci1

Description

@pricci1

Thanks for this implementation!

I made this little script to use "any" editor on the local side: rmate-server

How it works:

  1. 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.
  2. 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.
  3. 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).
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions