Recently, I needed to add an entry to the local domain name server on my home network. For many years, I have used Emacs to edit files on the terminal both locally and on remote systems. However, over the past year or so, I’ve become familiar with Visual Studio Code, and I very much enjoy its editing experience. I searched through the available extensions and found one called Remote VSCode.
It was originally developed for TextMate, but the Remote VSCode extension makes it work with Visual Studio Code. I installed the extension and then followed the link on the extension description page to download the Bash version of
rmate, the script which enables the remote side of the editing experience. I renamed the script and placed mine in
/usr/local/bin/rcode on my remote system.
Then, I edited my SSH configuration (
~/.ssh/config) to automatically forward the appropriate port required:
Host * ForwardAgent yes RemoteForward 52698 127.0.0.1:52698
Next, I connected to my remote system via SSH within the Visual Studio Code terminal window:
Finally, I edited my local nameserver configuration using the rcode script.
The file appears directly within Visual Studio Code, allowing you to make changes and save the file remotely. Easy, right?
While the extension does not allow browsing the remote filesystem to search for and edit files, it does allow you to easily navigate using your shell and edit multiple files simultaneously using Visual Studio Code’s tabs. It’s been a big help to me.