{"id":15657025,"url":"https://github.com/tomarrell/vim-npr","last_synced_at":"2025-05-05T15:28:54.266Z","repository":{"id":37035802,"uuid":"128284609","full_name":"tomarrell/vim-npr","owner":"tomarrell","description":"Sensible 'gf' for Node Path Relative JS module resolution per project 🐿","archived":false,"fork":false,"pushed_at":"2022-06-22T09:04:04.000Z","size":37,"stargazers_count":23,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T22:05:10.624Z","etag":null,"topics":["configure","defintion","goto","nodejs","package","vim"],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomarrell.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":"2018-04-06T01:42:01.000Z","updated_at":"2024-07-01T06:09:04.000Z","dependencies_parsed_at":"2022-08-18T02:45:07.495Z","dependency_job_id":null,"html_url":"https://github.com/tomarrell/vim-npr","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomarrell%2Fvim-npr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomarrell%2Fvim-npr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomarrell%2Fvim-npr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomarrell%2Fvim-npr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomarrell","download_url":"https://codeload.github.com/tomarrell/vim-npr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252523694,"owners_count":21761961,"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":["configure","defintion","goto","nodejs","package","vim"],"created_at":"2024-10-03T13:05:07.962Z","updated_at":"2025-05-05T15:28:54.248Z","avatar_url":"https://github.com/tomarrell.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vim-NPR :mag_right::bookmark_tabs:\nA plugin for sensible Node Path Relative module resolution in Javascript on a project-by-project basis. This will allow Vim to resolve modules using `gf`, even when they're using Node Path Relative, or custom resolution directories in your webpack configuration.\n\n## Installation\nSupports Vim-Plug, Vundle, and likely any other vim plugin manager that uses a similar format.\n\nAdd the following line to your `.vimrc` file:\n```vim\nPlug 'tomarrell/vim-npr'\n```\n\n## Configuration\nSimply add a resolve key to your project's `package.json` file with an array of directories you would like the file to potentially be resolved relative to. The plugin will find this key and resolve your files as per the directories listed. \n\nIf a `package.json` file can be found, however no `resolve` key is present, the plugin will default to the following directories for resolution:\n```js\n{\n  // ...\n  \"resolve\": [\"src\", \"lib\", \"test\", \"public\", \"node_modules\"],\n  // ...\n}\n```\nIf these directories don't exist, or the plugin cannot find the file under the cursor, the plugin will simply fail to resolve the file.\n\nBy default, the plugin will resolve the `package.json` by traversing up *5* directories, this number is configurable using the `g:vim_npr_max_levels` variable.\n\nThe plugin will be active whenever you enter a buffer with the extension .js, .jsx, .css or .coffee.\n\nFinally, if the exact file name with extension is not provided in the path, the plugin will attempt a list of defaults. These are appended to the path for each match attempt. The default list is:\n\n```vim\nlet g:vim_npr_file_names = [\"\", \".js\", \"/index.js\"]\n```\n\nNote that \"\" (empty string) and \".js\" (plain .js extension) are important to resolve exact files and paths simply omitting the extension respectively. \n\n## Usage\nWorks with ES, AMD, and CommonJS module definitions.\n\nAn example of the possible module resolution types are below, provided correct configuration. {NPR} represents a configured or default relative directory, which can be specified in your package.json as the resolve array:\n\n```javascript\nimport Header from 'Header';            // will resolve {NPR}/Header/index.js\nimport Header from 'Header/index.js';   // will resolve {NPR}/Header/index.js\nimport Header from 'Header/style.css';  // will resolve {NPR}/Header/style.css\nimport Button from 'Header/Button';     // will resolve {NPR}/Header/Button/index.js\n\nimport Header from '~/components/Header';          // will resolve {NPR}/components/Header/index.js\nimport Header from '~/components/Header/index.js'; // will resolve {NPR}/components/Header/index.js\n\nimport React from 'react';              // will resolve {NPR}/react/index.js\nimport { connect } from 'react-redux';  // will resolve {NPR}/react-redux/lib/\n```\n\nIt even works throughout your CSS.\n```css\n@import 'variables.css';  /* will resolve {NPR}/variables.css */\n@import 'Home/style.css'; /* will resolve {NPR}/Home/style.css */\n```\n\nIt functions the same as the traditional vim *gf* command, without getting in the way of your other language file resolvers.\n\n## License\nLicensed under the GNU GPL v3.0 license. Please see the extended license terms [here](https://www.gnu.org/licenses/gpl-3.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomarrell%2Fvim-npr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomarrell%2Fvim-npr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomarrell%2Fvim-npr/lists"}