sponsor Vim development Vim logo Vim Book Ad

ftpsync : Synchronize files with a remote server

 script karma  Rating 44/18, Downloaded by 2313  Comments, bugs, improvements  Vim wiki

created by
Fabien Bouleau
script type
The FtpUpdate script provides you the ability to synchronize your files with a server. The main idea when I created this script was to use GVim to edit the files on my local PC, which one has SVN or GIT, rather than directly on the remote server in a shared directory (similar to the staging concept in GIT).

With S-F7, you can define the server and the remote path used. The settings can be set for the buffer only or globally if you have many files to synchronize from/to the same directory. You can set both, and then buffer settings will preempt global settings.

Key mapping:

  - <S-F5> and <S-F6>: allow you to update your file respectively from and to the server. Asks for the synchronization parameters if needed.
  - <S-F7>: set the synchronization parameters.
  - <S-F8>: display the synchronization parameters of the current buffer.

Public functions:

  - FtpGetParam(): display the synchronization parameters of the current buffer.
  - FtpSetParam(...): set the synchronization parameters
  - FtpSetServer(...): set the server parameter
  - FtpSetPath(...): set the path parameter
  - FtpUpdate(): put the buffer to the remote server
  - FtpRefresh(): get the file from the remote server

Note that you can set both global parameters and buffer parameters for a specific buffer which needs different parameters. The buffer settings are taken into account before the global ones.

Further more, through the FtpSetPath or FtpSetServer functions, you can set only a specific path or server for a buffer, the second parameter (path or server) being taken from the global variable.


With <S-F7> you set global parameters srv1 and path /home/user1. Then for a specific buffer you type :call FtpSetPath() and set /home/dummy2 as buffer path (or type :call FtpSetPath("/home/user2","b")).
Then using <S-F5> or <S-F6> on this buffer will use ftp://srv1/home/user2 and ftp://srv1/home/user1 for the other ones.

The protocol used is FTP. Writing and reading are performed through netrw.vim plugin, i.e. as typing

    :write <proto>://<server>/<path>/<file>
    :read <proto>://<server>/<path>/<file>

Note that <proto> is set in g:FtpSync_Proto (scp by default).
install details
Copy the ftpsync.vim file into your $VIM/vimfiles/plugin directory and restart VIM

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
ftpsync.vim 1.2 2006-03-06 6.0 Fabien Bouleau Added g:FtpSync_Proto to select protocol (scp is default). See vim help on ftp for more details.
ftpsync.vim 1.1 2004-09-17 6.0 Fabien Bouleau Bug fix in displaying path with S-F8
ftpsync.vim 1.0 2004-08-24 6.0 Fabien Bouleau Added <S-F7> to set parameters without passing by <S-F5>
Added <S-F8> to display buffer parameters
Updated the documentation
ftpsync.vim 0.1 2004-03-12 6.0 Fabien Bouleau Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github