Question

I've been using Vim (MacVim) exclusively for months now, and I love it. Before using Vim though, I used Coda (I'm on OSX), and the one thing I miss about Coda is the way it marks my files for publishing via FTP whenever I edit them. I can then choose to upload the modified files single files individually, or to publish all of them in one go.

Is there anything that will do this or similar in Vim?

I'm aware netrw can edit directly over FTP, but I have all my sites running locally as mirrors of the online sites, so I need to edit locally and publish files remotely as and when I need. I've Googled for solutions but can't find anything.

I'm far more productive in Vim while in the editor, but having to open up an FTP program and hunt and peck to copy across files as I edit them seperately is a real pain, and makes me less productive overall when working on websites when compared to working in Coda.

Any suggestions welcome :)

Was it helpful?

Solution 3

I have since stumbled upon a Vim plugin which works with Transmit (which I happen to use as my main FTP client) and allows me to upload the current file to the server with a simple keymap (Ctrl+U) as I edit.

This strikes a nice balance between being a very simple solution, and one that does enough of what I need to improve my productivity significantly.

Any more suggestions are still welcome!

OTHER TIPS

  1. Transmit, Cyberduck and YummyFTP (the ones I know) all have their own version of "automated folder syncing" where you work locally and any modified files are uploaded on change: you setup an "observer" and never have to hit a special button or shortcut again.

  2. If you want to only use MacVim you could write a little command that uploads the current file on save: a script that would use the current file's path to construct an scp command. But this doesn't seem very portable/practical to me. It appears some people have already written something like that: here and there.

  3. The right way is (not only in my opinion) to:

    • have everything under some kind of VCS like Git, Subversion or Mercurial or whatever floats your boat

    • write your code in a local clone/checkout and test the hell out of it on a local server

    • commit only working code

    • push milestones to a staging server used by you and your clients to test everything, this part can be automated via a post-commit hook or something like that

    • deploy only validated changes on your production server.

    All the aforementioned Version Control Systems can be used directly from Vim's command line with :!git commit or :!svn update… If you need more abstraction, Fugitive (Git-only) or VCSCommand (multi-VCS, my choice) are here to help.

On your loss of productivity due to uploading files: I think it's very normal because you essentially perform very different tasks with very different neurological needs. This speed bump can also be experienced when previewing a layout change in your browser, looking up a color in Photoshop or any other similar task. I don't know of a way to pilot Photoshop, Chrome's dev tools or Outlook from within Vim and I don't think such a gizmo could reallistically exist so you will probably have to bear with it.

You can try git-ftp - a git based command line ftp client. Then you can manage your project as a Git repository, and git-ftp will only upload the files marked with Git - and only if they have changed.

The downside is that you are going to have to learn Git - and that's a bit overkill for what you need. The upside is that you are going to learn and use Git.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top