{"id":19309615,"url":"https://github.com/roxma/nvim-yarp","last_synced_at":"2025-06-11T07:09:28.445Z","repository":{"id":39614434,"uuid":"106822993","full_name":"roxma/nvim-yarp","owner":"roxma","description":"Yet Another Remote Plugin Framework for Neovim","archived":false,"fork":false,"pushed_at":"2022-06-08T03:27:56.000Z","size":40,"stargazers_count":230,"open_issues_count":10,"forks_count":14,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-24T03:23:58.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Vim script","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-10-13T12:43:26.000Z","updated_at":"2024-11-09T01:16:21.000Z","dependencies_parsed_at":"2022-07-20T03:32:37.091Z","dependency_job_id":null,"html_url":"https://github.com/roxma/nvim-yarp","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%2Fnvim-yarp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fnvim-yarp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fnvim-yarp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fnvim-yarp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roxma","download_url":"https://codeload.github.com/roxma/nvim-yarp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxma%2Fnvim-yarp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259219689,"owners_count":22823574,"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":[],"created_at":"2024-11-10T00:19:58.072Z","updated_at":"2025-06-11T07:09:28.396Z","avatar_url":"https://github.com/roxma.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Yet Another Remote Plugin Framework for Neovim\n\nThis is my attempt on writing a remote plugin framework without\n`:UpdateRemotePlugins`.\n\n## Requirements\n\n- `has('python3')`\n- For Vim 8:\n  - [roxma/vim-hug-neovim-rpc](https://github.com/roxma/vim-hug-neovim-rpc)\n  - `g:python3_host_prog` pointed to your python3 executable, or `echo\n      exepath('python3')` is not empty.\n  - [pynvim](https://github.com/neovim/pynvim) (`pip3\n      install pynvim`)\n\n## Installation\n\n### With [Vim-Plug](https://github.com/junegunn/vim-plug), use:\n\n```vim\n    \" Required for vim 8\n    Plug 'roxma/vim-hug-neovim-rpc'\n    \" Install this plugin\n    Plug 'roxma/nvim-yarp', { 'do': 'pip install -r requirements.txt' }\n```\n\n## Use case\n\n- [shougo/deoplete.nvim](https://github.com/shougo/deoplete.nvim)\n- [ncm2/ncm2](https://github.com/ncm2/ncm2) and most of its plugins\n\n## Usage\n\npythonx/hello.py\n\n```python\nimport vim, time\ndef greet():\n    time.sleep(3)\n    vim.command('echo \"Hello world\"')\n```\n\nplugin/hello.vim\n\n```vim\n\" Create a python3 process running the hello module. The process is lazy load.\nlet s:hello = yarp#py3('hello')\n\ncom HelloSync call s:hello.request('greet')\ncom HelloAsync call s:hello.notify('greet')\n\n\" You could type :Hello greet\ncom -nargs=1 Hello call s:hello.request(\u003cf-args\u003e)\n```\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## Options\n\n`let s:yarp.on_load = function('your_handler')`\n\nA handler that is called after your python module is loaded. It is not\nconsidered ready for request or notification from vimscript during loading\nstage. `s:yarp.request` and `s:yarp.notify` internally wait until `on_load`\nbefore sending actual request and notification.\n\n## Methods\n\n`call s:yarp.reqeust({event}, [, {args}...])`\n\nSimiliar to `:help rpcrequest`. It sends a request to the rpc channel and\nreturns the result of your python method.\n\n`call s:yarp.rpcnotify({event}, [, {args}...])`\n\nSimiliar to `:help rpcnotify`. It sends a notification to the rpc channel and\nreturns immediately.\n\n`call s:yarp.error(msg)`\n\nPrint error message.\n\n`call s:yarp.warn(msg)`\n\nPrint warning message.\n\n## Example for existing neovim rplugin porting to Vim 8\n\nMore realistic examples could be found at\n[nvim-typescript#84](https://github.com/mhartington/nvim-typescript/pull/84),\n[deoplete#553](https://github.com/Shougo/deoplete.nvim/pull/553),\n[callmekohei/quickdebug](https://github.com/callmekohei/quickdebug).\n\nNow let's consider the following simple rplugin.\n\nAfter `UpdateRemotePlugins` and restarting neovim, you get `foobar` by `:echo\nBar()`.\n\n```python\n# rplugin/python3/foo.py\nimport pynvim\n\n@pynvim.plugin\nclass Foo(object):\n\n    def __init__(self, vim):\n        self._vim = vim\n\n    @pynvim.function(\"Bar\", sync=True)\n    def bar(self, args):\n        return 'hello' + str(args)\n```\n\nFor working on Vim 8, you need to add these two files:\n\n\n```vim\n\" plugin/foo.vim\nif has('nvim')\n    finish\nendif\n\nlet s:foo = yarp#py3('foo_wrap')\n\nfunc! Bar(v)\n    return s:foo.call('bar',a:v)\nendfunc\n```\n\n\n```python\n# pythonx/foo_wrap.py\nfrom foo import Foo as _Foo\nimport vim\n\n_obj = _Foo(vim)\n\n\ndef bar(*args):\n    return _obj.bar(args)\n```\n\nHow to use\n```\n$ vim\n\n: echo bar('world')\n\nhello('world',)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxma%2Fnvim-yarp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froxma%2Fnvim-yarp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxma%2Fnvim-yarp/lists"}