Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

EXPERIMENTAL

License

NotificationsYou must be signed in to change notification settings

roxma/vim-hug-neovim-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is anexperimental project, trying to build a compatibility layer forneovim rpc client working on vim8.I started this project because I want to fix thevim8support issue fornvim-completion-manager.

Since this is a general purpose module, other plugins needing rpc support maybenefit from this project. However, there're many neovim rpc methods I haven'timplemented yet, which make this an experimental plugin.Please fork andopen a PR if you get any idea on improving it.

Tip: for porting neovim rplugin to vim8, you might needroxma/nvim-yarp

screencast

Requirements

  1. vim8
  2. Ifhas('pythonx') andset pyxversion=3
    • same requirements as4. has('python3')
  3. Else ifhas('pythonx') andset pyxversion=2
    • same requirements as5. has('python')
  4. Else ifhas('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
  5. Else ifhas('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
  6. set encoding=utf-8 in your vimrc.

Use:echo neovim_rpc#serveraddr() to test the installation. It should printsomething like127.0.0.1:51359 or/tmp/vmrUX9X/2.

API

FunctionSimilar 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 thatneovim_rpc#jobstart only support these options:

  • on_stdout
  • on_stderr
  • on_exit
  • detach

Incompatibility issues

  • Cannot passFuncref object to python client. Pass function name instead.
  • PythonNone will be converted to'' instead ofv:null into vimscript.Seevim#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 beforestarting vim/nvim.

let$NVIM_PYTHON_LOG_FILE="/tmp/nvim_log"let$NVIM_PYTHON_LOG_LEVEL="DEBUG"

About

EXPERIMENTAL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors11


[8]ページ先頭

©2009-2025 Movatter.jp