Editing file on ssh with a local GUI editor

Posted by 03263@reddit | linuxadmin | View on Reddit | 48 comments

I'm looking for something that would save a bit of time with editing files on an SSH connection

My envisioned workflow is something like:

$ ssh hostname
$ cd /var/log
$ !local-edit $SSH_HOST $PWD/huge.log

Where $SSH_HOST is the hostname used to connect, as configured in ~/.ssh/config, and the local-edit command spawns a script like this:

if ! mounted $1; then
    gvfs-mount $1
fi
$VISUAL ssh://$2

It would save the work of opening my file manager to mount the ssh connection, navigating to the file path and then opening it in my editor.

Does anyone have a setup like this they could share, or know of a tool that accomplishes it?