-
Notifications
You must be signed in to change notification settings - Fork 0
Remote edition with Atom
Supported editors: Atom / TextMate / SublimeText
this document will describe the method for Atom, but you can do this with others, the only difference being the editor plugin
- Install the plugin remote-atom
apm install remote-atom
- forward the ssh port to the remote-atom port (default:52698)
2 methods
- with an alias
SSH_PORT = your_ssh_port
alias rp3r='ssh -i ~/.ssh/rp3_rsa [email protected] -R $SSH_PORT\:localhost:52698 -p $SSH_PORT'
- with ssh config (simply create a file ~/.ssh/config containing the following rule, replacing 0000 with your ssh port and rp3_rsa with your ssh key filename)
Host rp3r
HostName rp3.redpelicans.com
Port 0000
User redpelicans
IdentityFile ~/.ssh/rp3_rsa
RemoteForward 0000 localhost:52698
- rmate (there are many ports, my favorite being the bash one)
Put rmate somewhere in your PATH or alias it, mine is:
alias atom='~/bin/rmate'
Then configure the port in rmate to your ssh port, the variable name being port.
- Launch Atom, then : Packages > Remote Atom > Start Server
The editor will now listen for a file to edit.
-
Use the alias
rp3r
to connect to your server, orssh rp3r
if you use ssh config. -
Now, you can use
rmate
on a file, it should open a new tab in Atom (and focus the window 👍).
Note: you can only open one file per one file, opening multiple files or a whole folder would need some scripting. I'll probably write one soon. Or if you write one, please share :)
When you save a file, the file is send to the server, and refreshed; it allows the WebpackHotMiddleware to watch every modification of files, without having to close the editor. tl;dr : enjoy the live-reload when you :w