Gvim / Vim as a FTP-program?

867 Views Asked by At

I'm a fairly new Gvim- (or Vim)-user, and I'm falling absolutely in love with it. Earlier I've used Dreamweaver, whenever I'm working on HTML- og PHP-files, since it's easy to jump between files (which NERDTree solved for me). But it's especially easy in Dreamweaver to upload files to the remote server (since it's just pressing 'CTRL-shift-U', whereafter Dreamweaver will (attempt) to upload it). It's by no means flawless, but it works 90% of the time, which is lovely. And NERDTree can't do this.

I've googled around, but without any luck. So I was just curious, what other Vim og Gvim-users does, when uploading files to a remote server? Are they really alt-tabbing to a Filezilla-program and uploading it through that? It seems so clumsy.

And even though I fear that this topic will be closed when I ask this last add-on question, then I'll still risk it: In case that there isn't a good way to do it in Vim or Gvim. What other programs can people in here recommend, for nice text-editors/coding-editors with a nice integrated FTP-client?

3

There are 3 best solutions below

1
On BEST ANSWER

I would suggest you go for an automated deployment method that works with your version control system of choice. There are all sorts of solutions out there: Capistrano, Fabric, beanstalkapp, and many others. There are lower tech solutions like rsync or use git push.

However if you must use FTP and you can not use a deployment script then I would suggest you use a file watcher (e.g. grunt, guard, gulp). These programs will watch your file and then execute any command or plugin (e.g. guard-upload) whenever a file is created/modified/deleted.

0
On

I'd suggest you to use third-party tools based on FUSE + some GUI tool for convenient mounting. The pros of this approach are that you will be able not only to edit the files with Vim without distraction, but also bring all the power of UNIX shell to your tasks.

1
On

This is built into Vim, with the standard netrw plugin that comes with every Vim installation. Ironically, NERDTree is designed to partially replace netrw...but I think it only replaces netrw for local directories.

You said in a comment that you're worried about keeping a local copy. Don't be worried about that. Simply edit your local copy, save it, and when you're ready to upload:

:w ftp://example.com/path/to/file

This is exactly like the way you would save a second copy of a file on your local system. Just be sure to use :w instead of :saveas if you want to keep working on your local copy.

It's possible (although unlikely) that NERDTree will cause some conflicts with this, since it is designed to partially replace netrw. You can try disabling NERDTree if you have problems, but I think it's designed to play nicely.