Sublime Text 2 is a wonderful editor, and for a while I’ve been wanting to use it as my primary tool for programming. There numerous issues with sublime text and a mounted FTP drive under gnome were stopping me however, and I’m happy to say I have a few workarounds:
4KB Filesize Limitation
Problem: Some files over 4kb will load as blank files, and can be overwritten if you accidentally save.
Workaround: Change the protocol. SSH and WebDav gvfs mounts both seem to work just fine. FTP seems to be the only protocol with the issue.
Slow refresh, and the inability to save files.
Problem: After a set period of time, the ftp mount will disconnect and sublime can toss various issues about reloading files and being unable to save. This isn’t really sublime’s fault, but rather due to the lack of a keep alive option with gvfs.
Workaround: A simple bash script can keep all FTP sessions alive. Here’s a quick guide on how to do just that.
Save the following file as gvfs-keep-alive. You can replace sleep 30 with sleep 15 if your sessions still close. I found 30 to be sufficient for most hosts.
#!/bin/bash
while true
do
ls ~/.gvfs/* &> /dev/null
sleep 30
done
Next up is to make it executable:
$ sudo install ./gvfs-keep-alive /usr/bin
$ sudo chmod +x /usr/bin/gvfs-keep-alive
And finally, add to the end of your startup queve.
$ sudo nano /etc/rc.d/rc.local
Add gvfs-keep-alive to the last line in that file, save and exit. You’re done!
I hope this helps someone, and if you don’t have SSH privileges with your server then I apologize - you’re out of luck for now. As a final note, these same ideas should all work for Mac (I noticed that mac ftp file mounting has the exact same issue). I haven’t tested it myself but it would be worth the try.