Ⅰ. 插件描述
Vim clientserver protocol libraryⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'ynkdir/vim-remote'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'ynkdir/vim-remote'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'ynkdir/vim-remote'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/ynkdir/vim-remote
Ⅳ. 文档说明
Vim clientserver protocol library
License: VIM LICENSE (see :help license)
supported:
serverlist()
remote_send()
remote_expr()
not supported:
remote_foreground()
remote_peek()
remote_read()
server2client()
Example:
Compile vim-remote library.
Linux:
$ make -f Makefile.x11
Windows (VC++):
> nmake -f Makefile.msvc
Windows (MinGW):
> make -f Makefile.mingw
Start the sample python server.
$ python main.py --servername py --server
You can evaluate Python expression with remote_expr().
Start Vim and execute the following command.
:echo remote_expr('py', 'print("This is Python expression")')
None
"None" is result of Python expression.
And the message will be displayed on the console.
Also, it is possible to call client function from server.
:function! F()
: echo "This is Vim expression"
: return "And this is result from Vim"
:endfunction
:let pyexpr = printf('remote_expr("%s", "F()")', v:servername)
:let result = remote_expr('py', pyexpr)
This is Vim expression
:echo result
And this is result from Vim