{"id":13442416,"url":"https://github.com/roxma/vim-hug-neovim-rpc","last_synced_at":"2025-03-20T13:33:33.630Z","repository":{"id":51327162,"uuid":"82276662","full_name":"roxma/vim-hug-neovim-rpc","owner":"roxma","description":"EXPERIMENTAL","archived":true,"fork":false,"pushed_at":"2021-05-15T01:50:28.000Z","size":79,"stargazers_count":218,"open_issues_count":8,"forks_count":28,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-10-28T05:13:20.365Z","etag":null,"topics":["neovim","python-client","rpc-library","vim8"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roxma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-17T08:48:27.000Z","updated_at":"2024-10-16T13:57:15.000Z","dependencies_parsed_at":"2022-09-10T14:22:41.731Z","dependency_job_id":null,"html_url":"https://github.com/roxma/vim-hug-neovim-rpc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fvim-hug-neovim-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fvim-hug-neovim-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fvim-hug-neovim-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fvim-hug-neovim-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roxma","download_url":"https://codeload.github.com/roxma/vim-hug-neovim-rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244619317,"owners_count":20482397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neovim","python-client","rpc-library","vim8"],"created_at":"2024-07-31T03:01:45.458Z","updated_at":"2025-03-20T13:33:33.625Z","avatar_url":"https://github.com/roxma.png","language":"Python","funding_links":[],"categories":["Tutorial"],"sub_categories":["Windows Manager"],"readme":"\n# vim-hug-neovim-rpc\n\nThis is an **experimental project**, trying to build a compatibility layer for\n[neovim rpc client](https://github.com/neovim/python-client) working on vim8.\nI started this project because I want to fix the [vim8\nsupport](https://github.com/roxma/nvim-completion-manager/issues/14) issue for\n[nvim-completion-manager](https://github.com/roxma/nvim-completion-manager).\n\nSince this is a general purpose module, other plugins needing rpc support may\nbenefit from this project. However, there're many neovim rpc methods I haven't\nimplemented yet, which make this an experimental plugin. **Please fork and\nopen a PR if you get any idea on improving it**.\n\n***Tip: for porting neovim rplugin to vim8, you might need\n[roxma/nvim-yarp](https://github.com/roxma/nvim-yarp)***\n\n![screencast](https://cloud.githubusercontent.com/assets/4538941/23102626/9e1bd928-f6e7-11e6-8fa2-2776f70819d9.gif)\n\n## Requirements\n\n\n1. vim8\n2. If `has('pythonx')` and `set pyxversion=3`\n    - same requirements as `4. has('python3')`\n2. Else if `has('pythonx')` and `set pyxversion=2`\n    - same requirements as `5. has('python')`\n4. Else if `has('python3')`\n    - [pynvim](https://github.com/neovim/pynvim)\n    - Pynvim is normally installed by `:py3 import pip; pip.main(['install',\n        '--user', 'pynvim'])` or `python3 -m pip install pynvim`.\n        If you are a win32 user, be careful that your python install and your\n        vim install should both the same architecture (both 64bit or both 32).\n    - There should be no error for at least one of `:python3 import pynvim` and\n        `:python3 import neovim`\n5. Else if `has('python')`\n    - [pynvim](https://github.com/neovim/pynvim)\n    - Pynvim is normally installed by `:py import pip; pip.main(['install',\n        '--user', 'pynvim'])` or `python2 -m pip install pynvim`.\n    - There should be no error for at least one of `:python3 import pynvim` and\n        `:python3 import neovim`\n6. `set encoding=utf-8` in your vimrc.\n\n***Use `:echo neovim_rpc#serveraddr()` to test the installation***. It should print\nsomething like `127.0.0.1:51359` or `/tmp/vmrUX9X/2`.\n\n## API\n\n| Function                                     | Similar to neovim's                            |\n|----------------------------------------------|------------------------------------------------|\n| `neovim_rpc#serveraddr()`                    | `v:servername`                                 |\n| `neovim_rpc#jobstart(cmd,...)`               | `jobstart({cmd}[, {opts}])`                    |\n| `neovim_rpc#jobstop(jobid)`                  | `jobstop({job})`                               |\n| `neovim_rpc#rpcnotify(channel,event,...)`    | `rpcnotify({channel}, {event}[, {args}...])`   |\n| `neovim_rpc#rpcrequest(channel, event, ...)` | `rpcrequest({channel}, {method}[, {args}...])` |\n\nNote that `neovim_rpc#jobstart` only support these options:\n\n- `on_stdout`\n- `on_stderr`\n- `on_exit`\n- `detach`\n\n## Incompatibility issues\n\n- Cannot pass `Funcref` object to python client. Pass function name instead.\n- Python `None` will be converted to `''` instead of `v:null` into vimscript.\n  See [vim#2246](https://github.com/vim/vim/issues/2246)\n- The following neovim-only API will be ignored quietly:\n    - `nvim_buf_add_highlight`\n    - `nvim_buf_clear_highlight`\n\n## Overall Implementation\n\n```\n   \"vim-hug-neovim-rpc - Sequence Diagram\"\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n\n┌───┐            ┌──────────┐                  ┌───────────┐                    ┌──────┐\n│VIM│            │VIM Server│                  │NVIM Server│                    │Client│\n└─┬─┘            └────┬─────┘                  └─────┬─────┘                    └──┬───┘\n  │   Launch thread   │                              │                             │\n  │───────────────────\u003e                              │                             │\n  │                   │                              │                             │\n  │                  Launch thread                   │                             │\n  │─────────────────────────────────────────────────\u003e│                             │\n  │                   │                              │                             │\n  │ `ch_open` connect │                              │                             │\n  │───────────────────\u003e                              │                             │\n  │                   │                              │                             │\n  │                   │────┐                         │                             │\n  │                   │    │ Launch VimHandler thread│                             │\n  │                   │\u003c───┘                         │                             │\n  │                   │                              │                             │\n  │                   │                              │           Connect           │\n  │                   │                              │\u003c─────────────────────────────\n  │                   │                              │                             │\n  │                   │                              ────┐\n  │                   │                                  │ Launch NvimHandler thread\n  │                   │                              \u003c───┘\n  │                   │                              │                             │\n  │                   │                              │    Request (msgpack rpc)    │\n  │                   │                              │\u003c─────────────────────────────\n  │                   │                              │                             │\n  │                   │                              ────┐                         │\n  │                   │                                  │ Request enqueue         │\n  │                   │                              \u003c───┘                         │\n  │                   │                              │                             │\n  │                   │     notify (method call)     │                             │\n  │                   │ \u003c────────────────────────────│                             │\n  │                   │                              │                             │\n  │ notify (json rpc) │                              │                             │\n  │\u003c───────────────────                              │                             │\n  │                   │                              │                             │\n  ────┐                                              │                             │\n      │ Request dequeue                              │                             │\n  \u003c───┘                                              │                             │\n  │                   │                              │                             │\n  ────┐               │                              │                             │\n      │ Process       │                              │                             │\n  \u003c───┘               │                              │                             │\n  │                   │                              │                             │\n  │                   │      Send response (msgpack rpc)                           │\n  │────────────────────────────────────────────────────────────────────────────────\u003e\n┌─┴─┐            ┌────┴─────┐                  ┌─────┴─────┐                    ┌──┴───┐\n│VIM│            │VIM Server│                  │NVIM Server│                    │Client│\n└───┘            └──────────┘                  └───────────┘                    └──────┘\n```\n\n\u003c!-- \n@startuml\n\ntitle \"vim-hug-neovim-rpc - Sequence Diagram\"\n\nVIM -\u003e \"VIM Server\": Launch thread\nVIM -\u003e \"NVIM Server\": Launch thread\nVIM -\u003e \"VIM Server\": `ch_open` connect\n\"VIM Server\" -\u003e \"VIM Server\": Launch VimHandler thread\n\nClient-\u003e \"NVIM Server\": Connect\n\"NVIM Server\" -\u003e \"NVIM Server\": Launch NvimHandler thread\nClient -\u003e \"NVIM Server\": Request (msgpack rpc)\n\"NVIM Server\" -\u003e \"NVIM Server\": Request enqueue\n\"NVIM Server\" -\u003e \"VIM Server\": notify (method call)\n\"VIM Server\" -\u003e VIM: notify (json rpc)\nVIM -\u003e VIM: Request dequeue \nVIM -\u003e VIM: Process\nVIM -\u003e Client: Send response (msgpack rpc)\n\n@enduml\n--\u003e\n\n## Debugging\n\nAdd logging settigns to your vimrc. Log files will be generated with prefix\n`/tmp/nvim_log`. An alternative is to export environment variables before\nstarting vim/nvim.\n\n```vim\nlet $NVIM_PYTHON_LOG_FILE=\"/tmp/nvim_log\"\nlet $NVIM_PYTHON_LOG_LEVEL=\"DEBUG\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxma%2Fvim-hug-neovim-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froxma%2Fvim-hug-neovim-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxma%2Fvim-hug-neovim-rpc/lists"}