rmate, rsub, ..rcode?

A tool I first discovered in my early days on Mac OS X, which would prove useful to me for years was called "rmate". rmate allows you to type rmate ~/somefile in a remote SSH shell and the remote file pops up in your TextMate app, on your local machine. This is done by having a tiny server listening on a specific port, which redirects the incoming data to a local temporary copy of the remote file and opens it in TextMate. When you make changes to that file, the server saves them right back to the remote file. As this is a brilliantly convenient way of handling remote files, a lots of people wrote plugins/extensions for various editors, to support this. The only things required for this to work, is a remotely forwarded port in your SSH command (-R 52698:localhost:52698) and a copy of rmate on the remote machine. When I started using SublimeText as my main editor, I found a package called rsub which is a port of the server-side for rmate. These days I've replaced SublimeText with Visual Studio Code and was happy to see that of course someone had already ported it. You can grab the extension here.

How to use rcode

All you need to do to be able to use rcode is to modify the SSH command you use to connect to a remote host. The rcode extension in VSCode spawns a server listening on port 52698. This is the default port the rmate script will work with. If you remote port forward that port to the same port on the remote machine, it will be able to communicate with the extension's server.

Here is an example of an SSH command enabling the use of rcode:
ssh user@host -R 52698:localhost:52698

Once connected to the remote host, download the latest version of the rmate script,

wget https://raw.githubusercontent.com/aurora/rmate/master/rmate -O /tmp/rmate

make it executable and move it to an appropriate *bin folder:

chmod +x /tmp/rmate [; and | && ] mv /tmp/rmate /usr/local/bin/