3

I'm working on a middle size PHP application. I'm currently switching from Netbeans to vim (bc it looks gross on Ubuntu). However, the only thing I do miss from Netbeans is a FTP upload after save.

My question is: is there a plugin which automatically uploads on save (or hotkey like ctrl u) in VIM?

3 Answers 3

1

I can not resist the advice to use ssh (scp / sftp) rather then ftp as I think it is more secure.

At any rate, vim will open files or save files over ftp (and scp).

vim ftp://[email protected]//path/to/file.php

Notice the double // :)

See this tutorial for details.

At any rate, to save a file you are working on locally over ftp, user Nwrite

Nwrite ftp://user@server/path/to/file.php

You can map that in vim with

cmap <Leader>r :Nread ftp://user@server/path/to/file.php
cmap <Leader>w :Nwrite ftp://user@server/path/to/file.php

Leader is a variable, by default it is /, but you can define it as another key

:let mapleader = "+"

For details See:

http://vim.wikia.com/wiki/Best_Vim_Tips#FTP_from_Vim

https://stackoverflow.com/questions/1764263/what-is-the-leader-in-a-vimrc-file

1
  • 2
    What would be a variable for file.php? I imagine everyone isn't editing only 1 file.
    – Goddard
    Aug 24, 2015 at 23:13
1

Take a loot at this

using this you can have a local working copy of a file and when you are editing using vim, you can save the minor changes directly to ftp server using upload command like this:

:Upload

you can make the change to the upload script given in that link,

But best way would be to use ssh/scp to tranfer the complete file over the ftp.

Also, using a versioning system like SVN or CVS would be better, you can commit the code changes, and those changes will be transferred using ssh. Also a versioning system will give you advanced tools like diff, using which you can compare your code changes to previous version and validate before commiting changes. This would avoid any errors due to typo.

1

The easy way to accomplish that goal does not involve a VIM plugin: simply mount the remote file system instead. In this way, files can be accessed as though they exist locally.

This is done via sshfs, if sshfs is available to you. (There is also an FTP filesystem that could work: ftpfs or 'curlftpfs' if you cannot use the excellent fuse/sshfs.)

Some links for the sshfs option:

Btw, does this NetBeans look gross? (You can get mostly around the problem with Java Swing applications and fonts.) There is also Komodo Edit and Eclipse (Eclipse Helios is good).

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .