I have a headless Ubuntu server created with vagrant and normally use vagrant ssh
to access and then mess around with the files.
I need to edit the files, and I'm not terribly keen on learning vim/emacs, so I'm wondering if I can use my editor of choice (Sublime Text 2) to edit the remote files.
How would you recommend I go about this? I've heard many solutions, FTP, rsync, vim/emacs, etc. but I'm not sure for my particular situation (Sublime and vagrant) what I would be best off doing.
Publishing files to the server with SublimeStart Sublime Text. On the File menu, click Open Folder. Select the folder on your local computer where you want to want edit files, and then click OK. In the sidebar, right-click the name of the folder you selected in step 3, click SFTP/FTP, and then click Map to Remote.
Use the DevTools "Elements" panel. A new sub-pane is added to this panel. Select "Edit as HTML", then select an HTML node. When you are ready, press the button to open the content in the Sublime Text editor.
To run code in Sublime Text, go to Tools > Build System, and select the language for your code (Sublime comes with support for various languages like Python, Ruby, Bash, and more). Next, press Cmd+B on Mac or Ctrl+B on Windows to run your code.
By default Vagrant will set up a share with your host machine automatically... /vagrant
on the server will be mapped to the folder containing your Vagrantfile
this allows you to edit anything in this folder and the changes will be made instantly on the ubuntu server as well.
You can also set up other shared/synced folders... check out the documentation.
The other options you have are creating a samba share (or AFP on OSX) or something similar and then mounting the share in your host machine and using sublime as per usual.
Sublime SFTP
might be a good solution for you. After the free trial is does cost US$16, but it's definitely worth it if you routinely work with files across FTP/SFTP/FTPS. It is authored by the same guy who created Package Control. You should be able to configure vagrant to allow this.
Another option is to use sshfs
with Vagrant to create a locally-mounted filesystem that you can access directly through ST2. If you're running on OSX, I highly recommend trying out Transmit. In my experience it's much easier to use than MacFUSE, is faster, a lot easier to set up, and is much more stable. Again, with the right config options vagrant should allow this pretty easily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With