{"id":15043982,"url":"https://github.com/thinca/node-vimhelp","last_synced_at":"2025-09-22T10:31:13.118Z","repository":{"id":57392606,"uuid":"60894799","full_name":"thinca/node-vimhelp","owner":"thinca","description":"Show the help of Vim","archived":false,"fork":false,"pushed_at":"2022-10-14T22:52:57.000Z","size":453,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-01T12:21:48.912Z","etag":null,"topics":["vim"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinca.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-11T06:50:01.000Z","updated_at":"2022-10-15T05:40:28.000Z","dependencies_parsed_at":"2023-01-20T02:02:12.646Z","dependency_job_id":null,"html_url":"https://github.com/thinca/node-vimhelp","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fnode-vimhelp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fnode-vimhelp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fnode-vimhelp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fnode-vimhelp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinca","download_url":"https://codeload.github.com/thinca/node-vimhelp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233841618,"owners_count":18738651,"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":["vim"],"created_at":"2024-09-24T20:49:54.845Z","updated_at":"2025-09-22T10:31:13.112Z","avatar_url":"https://github.com/thinca.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"node-vimhelp\n============\n\n[![NPM Version][npm-image]][npm-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Test][test-ci-badge]][test-ci-action]\n[![Lint][lint-ci-badge]][lint-ci-action]\n[![Test Coverage][codecov-image]][codecov-url]\n\nShow the help of [Vim](https://github.com/vim/vim).\n\nThis package uses Vim in background.  So you need Vim in your environment.\n\nRequirements\n------------\n\n- Node.js v22.0.0+\n- Vim\n  - Version 7.4 or later is recommended.\n- Git\n  - To use PluginManager.\n  - Git 2.3 or above is recommended.\n    - Because `GIT_TERMINAL_PROMPT` environment variable is available.\n      This script may freeze when the interactive prompt appears with old Git.\n      For example, when you specify the non-exist repository.\n\nInstallation\n------------\n\nInstall it using [npm](https://www.npmjs.com/):\n\n```\n$ npm install vimhelp\n```\n\nSynopsis\n--------\n\n```javascript\n// You can search the help of Vim.\nconst {VimHelp} = require(\"vimhelp\");\n\n(async () =\u003e {\nlet vimHelp = new VimHelp();\n\nlet text = await vimHelp.search(\"j\");\nconsole.log(text);\n/* The following text is shown:\nj               or                                      *j*\n\u003cDown\u003e          or                                      *\u003cDown\u003e*\nCTRL-J          or                                      *CTRL-J*\n\u003cNL\u003e            or                                      *\u003cNL\u003e* *CTRL-N*\nCTRL-N                  [count] lines downward |linewise|.\n*/\n})();\n\n\n// This package have a simple plugin manager.\nconst {PluginManager} = require(\"vimhelp\");\n\n(async () =\u003e {\n// Plugins are installed to under the basedir.\nlet manager = new PluginManager(\"/path/to/basedir\");\n\nawait manager.install(\"thinca/vim-quickrun\");\nconsole.log(manager.pluginNames);  // =\u003e [\"thinca/vim-quickrun\"]\n\nawait manager.install(\"vim-jp/vital.vim\");\nconsole.log(manager.pluginNames);  // =\u003e [\"thinca/vim-quickrun\", \"vim-jp/vital.vim\"]\n\nawait manager.uninstall(\"vim-jp/vital.vim\");\nconsole.log(manager.pluginNames);  // =\u003e [\"thinca/vim-quickrun\"]\n\n\n\n// You can also search the help of plugin with PluginManager.\nvimHelp.setRTPProvider(manager.rtpProvider);\nlet text = await vimhelp.search(\"quickrun\");\nconsole.log(text);\n// =\u003e *quickrun* is Vim plugin to execute whole/part of editing file.\n// =\u003e (...snip)\n\n// You can specify the 'helplang' option\nvimHelp.helplang = [\"ja\", \"en\"];\nlet text = await vimhelp.search(\"quickrun\");\nconsole.log(text);\n// =\u003e *quickrun* は編集中のファイルの全体もしくは一部を実行する Vim プラグインです。\n// =\u003e (...snip)\n\n})();\n```\n\nReferences\n----------\n\n### class VimHelp\n\n`VimHelp` can take help text of Vim via `vim` command.\n\n#### new VimHelp([{vimBin}])\n\n- `{vimBin}`\n  - Path to vim command.  \"vim\" in the `$PATH` is used in default.\n\n#### .search({subject})\n\nSearches `{subject}` from Vim's help and returns A Promise.\nWhen the `{subject}` is found, the Promise will be resolved by the help text.\nOtherwise, rejected an object like `{errorCode, resultText, errorText}`.\nIn most cases, `errorText` is useful to know the cause of error.\n\n#### .setRTPProvider({provider})\n\n- `{provider}`\n  - A runtimepath provider.  This is a function that has no arguments and returns an array of paths.\n\nThe runtimepaths from this is used in `.search()`.\n\n#### .helplang\n\nAn array of langs to set `'helplang'` option.\nDefault value is an empty array.\nex: `[\"ja\", \"en\"]`\n\n### class PluginManager\n\nPluginManager can install Vim plugins from any Git repository.\n\nThis class references the Vim plugin by `{plugin-name}`.\n`{plugin-name}` is one of the following.\n- A repository name of https://github.com/vim-scripts\n  - ex: `taglist.vim`\n- A GitHub repository name like `{user}/{repos}`\n  - ex: `vim-jp/vital.vim`\n- An URL of Git repository.\n  - ex: `https://bitbucket.org/ns9tks/vim-fuzzyfinder`\n\nThis class doesn't do a exclusive operation at all for simplification.\n\n#### new PluginManager([{basePath} [, {vimBin}]])\n\n- `{basePath}`\n  - Path to base of plugins.  All plugins are installed to under this directory.\n- `{vimBin}`\n  - Path to vim command.  \"vim\" in the `$PATH` is used in default.\n  - This is used when updating helptags.\n\n#### .plugins\n\nAn array of installed plugin informations.  Read only.\nEach entry is object as follows:\n\n```javascript\n{\n  pluginName: \u003cplugin name\u003e,\n  dirName: \u003cdir name\u003e,\n  runtimepath: \u003cruntimepath\u003e,\n  repository: \u003cURL of repository\u003e\n}\n```\n\n#### .pluginNames\n\nAn array of installed `{plugin-name}`s.  Read only.\n\n#### .runtimepaths\n\nAn array of paths of installed plugins.  Read only.\n\n#### .rtpProvider\n\nA function that returns paths of installed plugins.\nThis is not a method.  You can pass this function to `VimHelp.setRTPProvider()`.\nRead only.\n\n#### .install({plugin-name})\n\nInstalls a new Vim plugin.  Returns a Promise.\nWhen Installation succeeded, resolved by commit hash of Git which is version of installed plugin.\nOtherwise, rejected by Error object or an object like `{errorCode, resultText, errorText}`.\n\n#### .uninstall({plugin-name})\n\nUninstalls a installed Vim plugin.  Returns a Promise.\nWhen Uninstallation succeeded, resolved by the path of uninstalled plugin.\nOtherwise, rejected by Error object or an object like `{errorCode, resultText, errorText}`.\n\n#### .clean()\n\nUninstalls all Vim plugins.\n\n#### .update([{plugin-names}])\n\nUpdates installed plugins.  `{plugin-names}` is an array of `{plugin-name}`.\nWhen `{plugin-names}` is omitted, all plugins are updated.  Returns a Promise.\nWhen updating succeeded, resolved by the array of updating informations.\nAn updating information is following:\n\n- pluginName\n  - `{plugin-name}` of this plugin.\n- pluginPath\n  - A local path of this plugin.\n- beforeVersion\n  - A commit hash of Git which is version of before updating.\n- afterVision\n  - A commit hash of Git which is version of after updating.\n- updated()\n  - A function that returns true when this plugin is updated.\n\nWhen updating failed, resolved by the array of updating informations.\n\nTesting\n-------\n\n```\n$ npm test\n```\n\nLicense\n-------\n\n[zlib License](LICENSE.txt)\n\nAuthor\n------\n\nthinca \u003cthinca+npm@gmail.com\u003e\n\n\n[npm-image]: https://img.shields.io/npm/v/vimhelp.svg\n[npm-url]: https://npmjs.org/package/vimhelp\n[node-version-image]: https://img.shields.io/node/v/vimhelp.svg\n[node-version-url]: https://nodejs.org/en/download/\n[test-ci-badge]: ./../../workflows/Test/badge.svg\n[test-ci-action]: ./../../actions?query=workflow%3ATest\n[lint-ci-badge]: ./../../workflows/Lint/badge.svg\n[lint-ci-action]: ./../../actions?query=workflow%3ALint\n[codecov-image]: https://codecov.io/gh/thinca/node-vimhelp/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/thinca/node-vimhelp\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinca%2Fnode-vimhelp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinca%2Fnode-vimhelp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinca%2Fnode-vimhelp/lists"}