All Projects → roxma → Vim Hug Neovim Rpc

roxma / Vim Hug Neovim Rpc

Licence: mit
EXPERIMENTAL

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Vim Hug Neovim Rpc

Neovim Config
Neovim configuration
Stars: ✭ 180 (-9.55%)
Mutual labels:  neovim
Nyaovim
Web-enhanced Extensible Neovim Frontend
Stars: ✭ 2,166 (+988.44%)
Mutual labels:  neovim
Init.nvim
An Opinionated Neovim Config for the Minimalists
Stars: ✭ 194 (-2.51%)
Mutual labels:  neovim
Fast Ide
🕺Fast Integrated Development Environment 😻
Stars: ✭ 181 (-9.05%)
Mutual labels:  neovim
Dotfiles
My dotfiles: Experimental, ongoing configuration files, development environment and scripts for various Unix-like systems, text-based command-line applications and interfaces.
Stars: ✭ 185 (-7.04%)
Mutual labels:  neovim
Coc Pairs
Basic auto pairs extension of coc.nvim
Stars: ✭ 186 (-6.53%)
Mutual labels:  neovim
Uivonim
Fork of the Veonim Neovim GUI
Stars: ✭ 172 (-13.57%)
Mutual labels:  neovim
Vim Mix Format
Vim integration for the Elixir formatter.
Stars: ✭ 196 (-1.51%)
Mutual labels:  neovim
Deoplete Clang
deoplete.nvim source for C/C++/Obj-C/Obj-C++ with clang-python3
Stars: ✭ 186 (-6.53%)
Mutual labels:  neovim
Vim Signify
➕ Show a diff using Vim its sign column.
Stars: ✭ 2,390 (+1101.01%)
Mutual labels:  neovim
Markdown Preview.nvim
markdown preview plugin for (neo)vim
Stars: ✭ 2,858 (+1336.18%)
Mutual labels:  neovim
Alacritty Colorscheme
Change colorscheme of alacritty with ease.
Stars: ✭ 184 (-7.54%)
Mutual labels:  neovim
Vim Sneak
The missing motion for Vim 👟
Stars: ✭ 2,467 (+1139.7%)
Mutual labels:  neovim
Dotfiles
My [NeoVim + Tmux + Fish Shell] Setup /w install scripts
Stars: ✭ 180 (-9.55%)
Mutual labels:  neovim
Twf
Standalone tree view file explorer, inspired by fzf.
Stars: ✭ 196 (-1.51%)
Mutual labels:  neovim
Instant.nvim
collaborative editing in Neovim using built-in capabilities
Stars: ✭ 178 (-10.55%)
Mutual labels:  neovim
Diagnostic Languageserver
diagnostic language server integrate with linters
Stars: ✭ 186 (-6.53%)
Mutual labels:  neovim
Neovide
No Nonsense Neovim Client in Rust
Stars: ✭ 5,678 (+2753.27%)
Mutual labels:  neovim
Vim Packager
Vim plugin manager that utilizes "jobs" and "pack" features.
Stars: ✭ 197 (-1.01%)
Mutual labels:  neovim
Visual Split.vim
Vim plugin to control splits with visual selections or text objects
Stars: ✭ 190 (-4.52%)
Mutual labels:  neovim

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

screencast

Requirements

  1. vim8
  2. If has('pythonx') and set pyxversion=3
    • same requirements as 4. has('python3')
  3. Else if has('pythonx') and set pyxversion=2
    • same requirements as 5. has('python')
  4. Else if has('python3')
    • pynvim
    • Pynvim is normally installed by :py3 import pip; pip.main(['install', '--user', 'pynvim']) or python3 -m pip install pynvim.
    • There should be no error for at least one of :python3 import pynvim and :python3 import neovim
  5. Else if has('python')
    • pynvim
    • Pynvim is normally installed by :py import pip; pip.main(['install', '--user', 'pynvim']) or python2 -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 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 of v: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"
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].