Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neoclide/vim-node-rpc
Make vim behavior like neovim rpc server by use node server in the middle.
https://github.com/neoclide/vim-node-rpc
Last synced: about 1 month ago
JSON representation
Make vim behavior like neovim rpc server by use node server in the middle.
- Host: GitHub
- URL: https://github.com/neoclide/vim-node-rpc
- Owner: neoclide
- Created: 2018-07-18T07:04:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-21T19:29:51.000Z (over 1 year ago)
- Last Synced: 2024-04-24T13:36:52.257Z (5 months ago)
- Language: TypeScript
- Homepage:
- Size: 174 KB
- Stars: 62
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://github.com/neoclide/coc.nvim), you don't need
this module any more.## How it works
![group](https://user-images.githubusercontent.com/251450/43032696-d71ef922-8cef-11e8-9ecc-392b1fbc29ed.png)
![gif](https://pic3.zhimg.com/80/v2-1e44bac755aa8b6193520c7d56dd1857_hd.gif)
## Play with it
Install [nodejs](https://nodejs.org/en/download/) and [yarn](https://yarnpkg.com/en/docs/install)
Install [python-client](https://github.com/neovim/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` as
`channelId` 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_lua`
- `nvim_input`
- `nvim_buf_attach`
- `nvim_buf_detach`
- `nvim_get_hl_by_name`
- `nvim_get_hl_by_id`
- `nvim_buf_get_keymap`
- `nvim_buf_get_commands`
- `nvim_buf_add_highlight`
- `nvim_buf_clear_highlight`
- `nvim_replace_termcodes`
- `nvim_subscribe`
- `nvim_unsubscribe`
- `nvim_get_color_by_name`
- `nvim_get_color_map`
- `nvim_get_keymap`
- `nvim_get_commands`
- `nvim_get_chan_info`
- `nvim_list_chans`
- `nvim_parse_expression`
- `nvim_get_proc_children`
- `nvim_get_proc`Some methods requires python support of vim to work, you should either have
`has('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:
- `1Mb` around 13ms
- `100kb` < 5ms
- `10kb` < 1msRequest data from server:
- `1Mb` around 53ms
- `100kb` < 7ms
- `10kb` < 2ms## LICENSE
MIT