Ⅰ. 插件描述
Make vim behavior like neovim rpc server by use node server in the middle.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'neoclide/vim-node-rpc'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'neoclide/vim-node-rpc'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'neoclide/vim-node-rpc'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/neoclide/vim-node-rpc
Ⅳ. 文档说明
# vim-node-rpc
This module is made to make vim start a messagepack server as neovim
does, so that neovim remote plugins could work for vim.
Tested on vim 8.1.150, could works, but still W.I.P.
Install
If you're using coc.nvim, you don't need
this module any more.
How it works


Play with it
Install python-client (used for testing) by:
pip install pynvim
Start testing service by:
./start.sh
Now you can control your vim with python-client from neovim.
Have fun.
API
nvim#rpc#start_server()start server.nvim#rpc#check_client({clientId})check if clientId available.nvim#rpc#request({clientId}, {method}, [{arguments}])send request.nvim#rpc#notify({clientId}, {method}, [{arguments}])send notification.
The clientId would be send to client on method nvim_api_get_info aschannelId of neovim.
A client can connect to exists RPC server by listen to $NVIM_LISTEN_ADDRESS
like neovim client.
Limitation
There're some methods that no clear way to implement for vim:
nvim_execute_luanvim_inputnvim_buf_attachnvim_buf_detachnvim_get_hl_by_namenvim_get_hl_by_idnvim_buf_get_keymapnvim_buf_get_commandsnvim_buf_add_highlightnvim_buf_clear_highlightnvim_replace_termcodesnvim_subscribenvim_unsubscribenvim_get_color_by_namenvim_get_color_mapnvim_get_keymapnvim_get_commandsnvim_get_chan_infonvim_list_chansnvim_parse_expressionnvim_get_proc_childrennvim_get_proc
Some methods requires python support of vim to work, you should either havehas('python') or has('python3') to 1 with vim.
Performance
Here's the performance data on my mac use CPU: 2.6 GHz Intel Core i7
Request data from vim:
1Mbaround 13ms100kb< 5ms10kb< 1ms
Request data from server:
1Mbaround 53ms100kb< 7ms10kb< 2ms
LICENSE
MIT