Hommer Smith
Hommer Smith

Reputation: 27852

VIM support to upload via SFTP

I am used to Sublime's plugin that let's you do a mapping between your local project and a remote project. By doing so, when you are done editing a file, you can do a right click and "Upload file" action which automatically updates the file in the remote server.

I am wondering what would be the best way to do this while programming with VIM. I am looking for an easy way to be able to map a local project to a remote one and be able to upload the file easily.

Thanks

Upvotes: 5

Views: 10466

Answers (2)

romainl
romainl

Reputation: 196546

Most serious FTP clients let you edit remote files locally. Filezilla, gFTP, Transmit, Cyberduck, YummyFTP… they all have their own "Edit in…" button. GUI FTP clients may not be sexy hacker tools but they work very well.

Some of those serious FTP clients have synchronisation features or folder watchers. It might be worth your time to look around for such a feature.

Of course, you can also use Vim itself to edit a remote file via FTP or SFTP:

$ vim sftp://user@machine/filename
$ vim ftp://user@machne/filename

and list remote files:

$ vim sftp://user@machine/directory/

See :help netrw for more info.

Did you consider using a VCS like Subversion, Git or Mercurial?

Upvotes: 1

Faiz
Faiz

Reputation: 16255

If all you want is to edit files on a remote server, try vim's netrw feature:

vim scp://you@yourserver//path/to/directory/

Edit a file directly:

vim scp://you@yourserver//path/to/directory/somefile.txt

Or if you are already in vim, hit ESC, then type:

:e scp://you@yourserver//path/to/directory/

This assumes that:

  1. you have ssh installed (usually the case for Linux or OSX; if you are on Windows then it depends).
  2. you have ssh access to the server via some convenient method (sshagent and keys)

Upvotes: 12

Related Questions