{"id":28200451,"url":"https://github.com/nekowasabi/vim-rule-switcher","last_synced_at":"2025-06-12T10:31:40.266Z","repository":{"id":233038119,"uuid":"785861840","full_name":"nekowasabi/vim-rule-switcher","owner":"nekowasabi","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-21T10:22:10.000Z","size":88,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T06:54:27.574Z","etag":null,"topics":["denops","neovim","vim","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/nekowasabi.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-12T19:33:08.000Z","updated_at":"2025-02-05T03:45:23.000Z","dependencies_parsed_at":"2024-05-10T09:29:54.307Z","dependency_job_id":"02a143e0-c8e1-44fa-9ec9-713f601e1cde","html_url":"https://github.com/nekowasabi/vim-rule-switcher","commit_stats":null,"previous_names":["nekowasabi/vim-rule-switcher"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nekowasabi/vim-rule-switcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekowasabi%2Fvim-rule-switcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekowasabi%2Fvim-rule-switcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekowasabi%2Fvim-rule-switcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekowasabi%2Fvim-rule-switcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nekowasabi","download_url":"https://codeload.github.com/nekowasabi/vim-rule-switcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekowasabi%2Fvim-rule-switcher/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259447396,"owners_count":22859043,"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":["denops","neovim","vim","vim-plugin"],"created_at":"2025-05-16T20:11:22.341Z","updated_at":"2025-06-12T10:31:40.257Z","avatar_url":"https://github.com/nekowasabi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vim-rule-switcher\n\nThis Vim plugin provides a convenient way to switch between related files based\non custom rules. It's particularly useful in projects where files of different\ntypes or with different naming conventions are logically related, such as header\nand implementation files in C/C++ projects, or component and test files in web\ndevelopment.\n\n## Breaking Changes\n```\nThe specification of the configuration file has been changed due to the commit on 2025/01/21.\nPlease check the configuration section and update the json file.\n```\n\n## Features\n\n- Define custom switching rules based on file paths, prefixes, and postfixes.\n- Easily navigate between related files with a simple Vim command.\n- Supports integration with Git to switch between files tracked in the\n  repository.\n\n## Requirements\n\n- [denops.vim](https://github.com/vim-denops/denops.vim)\n\n## Installation\n\nYou can install vim-rule-switcher using your favorite plugin manager. For\nexample, with [vim-plug](https://github.com/junegunn/vim-plug):\n\n```vim\nPlug 'nekowasabi/vim-rule-switcher'\n```\n\nThen run `:PlugInstall` in Vim.\n\n## Configuration\n\nMake json file in `/path/to/example.json`.\n\n```json\n{\n  \"projects\": [\n    {\n      \"name\": \"nvim\",\n      \"rules\": [\n        {\n          \"rule\": \"file\",\n          \"path\": [\n            \"~/.config/nvim/rc/plugin.vim\",\n            \"~/.config/nvim/init.vim\"\n          ]\n        }\n      ]\n    },\n    {\n      \"name\": \"switcher\",\n      \"rules\": [\n        {\n          \"rule\": \"file\",\n          \"path\": [\n            \"~/.config/nvim/plugged/vim-rule-switcher/denops/switcher/main.ts\",\n            \"~/.config/nvim/plugged/vim-rule-switcher/denops/switcher/switcher.ts\"\n          ]\n        },\n        { \n          \"rule\": \"git\",\n          \"postfix\": \"Test\",\n          \"path\": [\n            \"%.ts\",\n            \"%Test.ts\"\n          ]\n        }\n      ]\n    }\n  ]\n}\n```\n\nDefine your switching rules in your `.vimrc` or `init.vim` like so:\n\n```vim\nlet g:switch_rule = \"/path/to/example.json\"\n```\n\n## Usage\n\nTo switch between files using the defined rules, use the following Vim command:\n\nYou can use the command:\n\n```vim\n:SwitchFileByRule [rule] [name]\n```\n\nExample usage: \n```\n:SwitchFileByRule git switcher\u003cCR\u003e\n```\n\nIf no `name` is given, the command will cycle through files according to all available rules. If either a `rule` or `name` is specified, it opens the first file associated with that specific rule or name.\n\nExplanation of `rule` types:\n\n- `file`: Switches to the file defined in the rule's path.\n- `git`: Uses `%` as a placeholder for the current file, allowing switches based on prefix or postfix rules.\n\nExample of a `git` rule:\nSuppose the current file is `main.ts`, and the rule is defined as:\n\n```json\n{\n  \"rule\": \"git\",\n  \"postfix\": \"Test\",\n  \"path\": [\n    \"%.ts\",\n    \"%Test.ts\"\n  ]\n}\n```\n\nThis rule will switch between `main.ts` and `mainTest.ts`.\n\nExecuting `SwitchFileByRule git` in this context will switch the buffer to `mainTest.ts`, assuming it is tracked in the git repository. Since `git ls-files` is used, specifying the path is unnecessary.\n\n`name`\nSpecifies the name.\n\n```vim\n:SelectSwitchRule\n```\nThis command allows you to choose from the available switch rules and apply the\nselected rule to switch files.\n\nIf no name argument is provided, it switches between files based on all defined rules.\nIf a name argument is provided, it will open the first file from the file paths\nassociated with that specific rule name.\n\nAvailable keybindings in the selection window:\n- 0-9: Select file by number\n- q: Quit the selection window  \n- o: Open the file under cursor\n\n```vim\n:SaveSwitchRule \u003crule_name\u003e\n```\n\nThis command will add the current file to the specified rule in the switch rule\njson file.\n\nTo edit the rules file, use the following command:\n\n```vim\n:OpenSwitchRuleFile\n```\n\nTo edit switch rule directly, use the following command:\n\n\n## Related Projects\n\n[vim-altr](https://github.com/kana/vim-altr)\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekowasabi%2Fvim-rule-switcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnekowasabi%2Fvim-rule-switcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekowasabi%2Fvim-rule-switcher/lists"}