ftpsync


Ⅰ. 插件描述

Synchronize files with a remote server

Ⅱ. 基本信息

创建日期:  2004-03-12
使用用户:  1
Github星:  2
插件作者:  Fabien Bouleau

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/ftpsync'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/ftpsync'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/ftpsync'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/ftpsync

Ⅳ. 文档说明

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.

Example:

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>
    or
    :read <proto>://<server>/<path>/<file>

Note that <proto> is set in g:FtpSync_Proto (scp by default).

添加新评论