12

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.

Doug Smith
  • 29,668
  • 57
  • 204
  • 388

2 Answers2

17

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.

Matt Cooper
  • 9,962
  • 2
  • 31
  • 26
  • This is correct. Although if for some reason this does not meet your needs, you can try the various alternatives for running Sublime Text over SSH here: http://stackoverflow.com/q/15958056/456584 – user456584 Aug 30 '13 at 18:02
  • 1
    In addition, this can be augmented by setting up shared folders in Dropbox, Google drive or similar. This allows for nice always available development environments. – dgo Jul 20 '14 at 19:56
4

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.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • `sshfs` worked well for me. I wanted to expose a folder within the remote to my host, such that I could easily use x and sublime on the host to make changes on the remote. – Ian Clark Aug 11 '15 at 07:44