Ⅰ. 插件描述
A vim script that reads a config file in your project's root directory and uses it to rsync stuff to a remote locationⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 's10g/vim-syncr-he-is-going'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 's10g/vim-syncr-he-is-going'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 's10g/vim-syncr-he-is-going'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/s10g/vim-syncr
Ⅳ. 文档说明
vim-syncr
vim-syncr is a simple vim script for uploading/downloading files to a remote location or deleting files from a remote location using rsync over ssh.
I needed to solve this workflow and its criterias:
- Local git repository with typical web files (html, php, images, etc)
- Remote web root
- Mirror my local environment to the remote web root minus files/directories marked for exclusion (yes "web files", no git folder)
Criterias:
- Must be able to "clean up" remotely by deleting or renaming files that I delete or rename locally
- Authorization and authentication must "Just work" with SSH keys; I want no hassle, no password prompts
I found vim-hsftp but I couldn't quite get it to work. It did however have excellent configuration loading code, so vim-syncr is forked from vim-hsftp. All credit goes to hesselbom/vim-hsftp; without it this project would never have been started.
Install:
Install like you would any other Vundle compatible plugin.
Usage:
Create a filed called .syncr in your project's root directory containing the following configuration, chmod it to 700 and chpwn it for security:
$ cat /Desktop/projects/newproject/.syncr
remote_host www-dev.example.com
remote_user bob
remote_path /home/bob/html/site1/
project_path ~/Desktop/projects/site1/Commands
:VsUploadSyncs files and directories with remote
:VsDeleteSyncs any file or directory deletions with remote
:VsDownloadSyncs files and directories with remote (grabs foreign new files)
Mappings
<leader>vsuCalls :VsUpload
<leader>vsdelCalls :VsDelete
<leader>vsdCalls :VsDownload