How to use Sublime Text to edit files over SSH
One of the things that I missed when swithcing from Textmate to Sublime Text was rmate, the CLI to open files in the server your are logged in over SSH in you local editor. Since I'm too lazy to learn advanced editing in vim I started searching for an alternative, and the good news is that it exists.
Host my_server Hostname 22.214.171.124 RemoteForward 52698 127.0.0.1:52698
Once that is done, log into your server (
ssh my_server) e download rmate (yes, the same one we would use for Textmate) there:
curl https://raw.github.com/aurora/rmate/master/rmate > rsubl. The last step is to move it to the bin volder and give it execution permission. In order to do that run the following:
sudo mv rsubl /usr/local/bin
sudo chmod +x /usr/local/bin/rsubl
From now on, as long as you have Sublime Text open in your computer, just run
rsubl file.rb and it will open the file in your editor. Change it and that's it, every save on that file will auto save it remotely. It also supports
sudo, so you can change your config files directly in Sublime Text.
Don't forgert to open the port in your firewall if you are using one.