JIe
2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
|
||
---|---|---|
.. | ||
autoload | ||
pythonx | ||
.gitignore | ||
LICENSE | ||
README.md |
vim-hug-neovim-rpc
This is an experimental project, trying to build a compatibility layer for neovim rpc client working on vim8. I started this project because I want to fix the vim8 support issue for nvim-completion-manager.
Since this is a general purpose module, other plugins needing rpc support may benefit from this project. However, there're many neovim rpc methods I haven't implemented yet, which make this an experimental plugin. Please fork and open a PR if you get any idea on improving it.
Tip: for porting neovim rplugin to vim8, you might need roxma/nvim-yarp
Requirements
- vim8
- If
has('pythonx')
andset pyxversion=3
- same requirements as
4. has('python3')
- same requirements as
- Else if
has('pythonx')
andset pyxversion=2
- same requirements as
5. has('python')
- same requirements as
- Else if
has('python3')
- pynvim
- Pynvim is normally installed by
:py3 import pip; pip.main(['install', '--user', 'pynvim'])
orpython3 -m pip install pynvim
. - There should be no error for at least one of
:python3 import pynvim
and:python3 import neovim
- Else if
has('python')
- pynvim
- Pynvim is normally installed by
:py import pip; pip.main(['install', '--user', 'pynvim'])
orpython2 -m pip install pynvim
. - There should be no error for at least one of
:python3 import pynvim
and:python3 import neovim
set encoding=utf-8
in your vimrc.
Use :echo neovim_rpc#serveraddr()
to test the installation. It should print
something like 127.0.0.1:51359
or /tmp/vmrUX9X/2
.
API
Function | Similar to neovim's |
---|---|
neovim_rpc#serveraddr() |
v:servername |
neovim_rpc#jobstart(cmd,...) |
jobstart({cmd}[, {opts}]) |
neovim_rpc#jobstop(jobid) |
jobstop({job}) |
neovim_rpc#rpcnotify(channel,event,...) |
rpcnotify({channel}, {event}[, {args}...]) |
neovim_rpc#rpcrequest(channel, event, ...) |
rpcrequest({channel}, {method}[, {args}...]) |
Note that neovim_rpc#jobstart
only support these options:
on_stdout
on_stderr
on_exit
detach
Incompatibility issues
- Cannot pass
Funcref
object to python client. Pass function name instead. - Python
None
will be converted to''
instead ofv:null
into vimscript. See vim#2246 - The following neovim-only API will be ignored quietly:
nvim_buf_add_highlight
nvim_buf_clear_highlight
Overall Implementation
"vim-hug-neovim-rpc - Sequence Diagram"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
┌───┐ ┌──────────┐ ┌───────────┐ ┌──────┐
│VIM│ │VIM Server│ │NVIM Server│ │Client│
└─┬─┘ └────┬─────┘ └─────┬─────┘ └──┬───┘
│ Launch thread │ │ │
│───────────────────> │ │
│ │ │ │
│ Launch thread │ │
│─────────────────────────────────────────────────>│ │
│ │ │ │
│ `ch_open` connect │ │ │
│───────────────────> │ │
│ │ │ │
│ │────┐ │ │
│ │ │ Launch VimHandler thread│ │
│ │<───┘ │ │
│ │ │ │
│ │ │ Connect │
│ │ │<─────────────────────────────
│ │ │ │
│ │ ────┐
│ │ │ Launch NvimHandler thread
│ │ <───┘
│ │ │ │
│ │ │ Request (msgpack rpc) │
│ │ │<─────────────────────────────
│ │ │ │
│ │ ────┐ │
│ │ │ Request enqueue │
│ │ <───┘ │
│ │ │ │
│ │ notify (method call) │ │
│ │ <────────────────────────────│ │
│ │ │ │
│ notify (json rpc) │ │ │
│<─────────────────── │ │
│ │ │ │
────┐ │ │
│ Request dequeue │ │
<───┘ │ │
│ │ │ │
────┐ │ │ │
│ Process │ │ │
<───┘ │ │ │
│ │ │ │
│ │ Send response (msgpack rpc) │
│────────────────────────────────────────────────────────────────────────────────>
┌─┴─┐ ┌────┴─────┐ ┌─────┴─────┐ ┌──┴───┐
│VIM│ │VIM Server│ │NVIM Server│ │Client│
└───┘ └──────────┘ └───────────┘ └──────┘
Debugging
Add logging settigns to your vimrc. Log files will be generated with prefix
/tmp/nvim_log
. An alternative is to export environment variables before
starting vim/nvim.
let $NVIM_PYTHON_LOG_FILE="/tmp/nvim_log"
let $NVIM_PYTHON_LOG_LEVEL="DEBUG"