xeno is a simple command line application for editing files and folders on a remote machine using your local text editor.
I’ve been a bit fed-up lately with remotely editing files. Sure you can use vim or emacs in a pinch for a one-off edit, or sync everything through a central Git repository, but if you’re trying to do any non-trivial edits to a website or application that really needs to be deployed remotely to operate, and you’re not a vim-ninja, things rapidly become tedious. Add to that the fact that you often have to leave behind the perfectly good text editor that you paid $70 for, have to deal with the high latency of key presses, and transfer any editor configuration - it all becomes very… irritating.
There are a couple of remote editing options at present, but they all suffer from one weakness or another. In particular, they either only allow you to edit a single file at a time, or they require complex kernel extentions and invocations to make work. Worst of all, none of them are robust against connection dropouts. Some of the more popular options:
The list goes on, but the issues are relatively the same. I needed something different…
Frustrated, I’ve spent a couple weekends putting together a slightly more minimalist and cross-platform replacement - xeno. It is largely geared towards my own usage patterns, and the usage reflects that.
xeno uses a Git/SSH mashup as its underlying transport and synchronization mechanism. When xeno is invoked, it will generate an out-of-work-tree Git repository on the remote machine to track and coordinate changes. xeno will then clone the remote repository, launch your local editor on the clone, and launch a daemon to keep the local and remote in-sync.
Because the remote Git repository is outside of the work tree, you can use it to edit remote folders which may already be Git repositories without any conflicts. xeno also works for editing single remote files. Best of all, because it uses Git, it will safely merge changes to and from the remote, and if your local editor is Git-aware, it will show you which changed files have or haven’t been synced to the remote.
xeno provides a variety of commands for starting, managing, resuming, and ending sessions. xeno is robust, and the daemon will continue trying to sync changes to the remote repository even if SSH access becomes temporarily unavailable. When the editing session is ended, xeno will automatically clean up all local and remote resources.
To start editing a remote path over SSH, use
xeno edit user@hostname:/the/path
xeno will clone the remote path locally and keep it in sync with the remote copy. Or, if you are already in an SSH session1, you can do
xeno edit /the/path
and it will have exactly the same effect!1: For in-session launches, you must use `xeno ssh`, a VERY thin wrapper around SSH which monitors console output for initialization messages
xeno uses a variet of subcommands to do its bidding (e.g. config, edit, …). To view help information for a particular subcommand, use:
xeno SUBCOMMAND_NAME --help
xeno supports the following subcommands:
edit: Starts editing sessions
config: Manages xeno configuration information
ssh: A pass-through to ‘ssh’ which monitors console output for session initialization
list: Lists active xeno sessions
resume: Resumes a xeno session (open your editor on the local copy)
stop: Stops a xeno session and cleans up local/remote resources
sync: Syncs a xeno session with the remote copy (automatically run as a daemon when using xeno edit to do periodic synchronization, and also available to manually push/pull changes on-demand)
For convenience, you can alias the
xeno edit as
xen. To keep consistency,
if you use the
xeno edit command on a local path, it will simply open the
local path in your editor, so you don’t have to use a different command to
launch your local editor.
xeno is written as a shell script, and is free and open-source. Feedback is very welcome and encouraged!