{"id":13601896,"url":"https://github.com/airblade/vim-rooter","last_synced_at":"2025-04-12T01:56:30.479Z","repository":{"id":857075,"uuid":"590245","full_name":"airblade/vim-rooter","owner":"airblade","description":"Changes Vim working directory to project root.","archived":false,"fork":false,"pushed_at":"2024-09-25T08:48:47.000Z","size":92,"stargazers_count":1250,"open_issues_count":6,"forks_count":73,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-12T01:56:26.544Z","etag":null,"topics":["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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/airblade.png","metadata":{"files":{"readme":"README.mkd","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2010-04-01T14:40:03.000Z","updated_at":"2025-04-11T16:02:09.000Z","dependencies_parsed_at":"2025-01-16T19:09:05.714Z","dependency_job_id":"cf35d84b-4601-4770-808d-7285daecf431","html_url":"https://github.com/airblade/vim-rooter","commit_stats":{"total_commits":132,"total_committers":30,"mean_commits":4.4,"dds":"0.25757575757575757","last_synced_commit":"51402fb77c4d6ae94994e37dc7ca13bec8f4afcc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airblade%2Fvim-rooter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airblade%2Fvim-rooter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airblade%2Fvim-rooter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airblade%2Fvim-rooter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/airblade","download_url":"https://codeload.github.com/airblade/vim-rooter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505864,"owners_count":21115354,"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-08-01T18:01:09.676Z","updated_at":"2025-04-12T01:56:30.458Z","avatar_url":"https://github.com/airblade.png","language":"Vim Script","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"# Rooter\n\nRooter changes the working directory to the project root when you open a file or directory.\n\nThe project root can be identified by:\n\n- being a known directory;\n- having a known directory or file;\n- being a subdirectory of a known directory.\n- being a direct subdirectory of a known directory\n\nYou can also exclude directories.\n\nFor a file or directory which doesn't have a root, Rooter can: do nothing; change to the file's directory (similar to `autochdir`); or change to your home directory.\n\n\n## Usage\n\nBy default you don't need to do anything: Rooter will change the working directory automatically and echo the new working directory.\n\nYou can turn this off (see below) and use the `:Rooter` command to invoke Rooter manually.\n\nWhen Rooter changes the working directory it emits the autocmd user event `RooterChDir`.\n\nRooter will unset `\u0026autochdir` if it's set.\n\n\n## Configuration\n\n\n### Which buffers trigger Rooter\n\nBy default all files and directories trigger Rooter.  Alternatively, set `g:rooter_targets` to a list of file path patterns which should trigger Rooter. Use a literal `/` to match directory buffers. For example:\n\n```viml\n\" Everything (default)\nlet g:rooter_targets = ['/', '*']\n\n\" Directories and everything under /home\nlet g:rooter_targets = ['/', '/home/*']\n```\n\nPatterns are tried in order until one of them matches. To specify a negative pattern, prefix it with a `!`. If no patterns match, Rooter is not triggered:\n\n```viml\n\" Everything (default), except files under /tmp\nlet g:rooter_targets = ['!/tmp/*', '/', '*']\n```\n\nComma-separated lists are also accepted:\n\n```viml\n\" All files\nlet g:rooter_targets = '*'\n\n\" YAML files\nlet g:rooter_targets = '*.yml,*.yaml'\n\n\" Directories and YAML files\nlet g:rooter_targets = '/,*.yml,*.yaml'\n```\n\n### Which buffer types trigger Rooter\n\nRooter only runs in buffer types where it makes sense to look for a root directory.\n\nA normal file has an empty `'buftype'`.  Directory browsing plugins often set the `'buftype'` to `\"nofile\"`, `\"nowrite\"`, or `\"acwrite\"`.  To stick to normal files:\n\n```viml\nlet g:rooter_buftypes = ['']\n```\n\n### How to identify a root directory\n\nSet `g:rooter_patterns` to a list of identifiers.  They are checked breadth-first as Rooter walks up the directory tree and the first match is used.\n\nTo specify the root is a certain directory, prefix it with `=`.\n\n```viml\nlet g:rooter_patterns = ['=src']\n```\n\nTo specify the root has a certain directory or file (which may be a glob), just give the name:\n\n```viml\nlet g:rooter_patterns = ['.git', 'Makefile', '*.sln', 'build/env.sh']\n```\n\nTo specify the root has a certain directory as an ancestor (useful for excluding directories), prefix it with `^`:\n\n```viml\nlet g:rooter_patterns = ['^fixtures']\n```\n\nTo specify the root has a certain directory as its direct ancestor / parent (useful when you put working projects in a common directory), prefix it with `\u003e`:\n\n```viml\nlet g:rooter_patterns = ['\u003eLatex']\n```\n\nTo exclude a pattern, prefix it with `!`.\n\n```viml\nlet g:rooter_patterns = ['!.git/worktrees', '!=extras', '!^fixtures', '!build/env.sh']\n```\n\nList your exclusions before the patterns you do want.\n\n\n### Non-project files\n\n- Don't change directory (default).\n\n    ```viml\n    let g:rooter_change_directory_for_non_project_files = ''\n    ```\n\n- Change to file's directory (similar to `autochdir`).\n\n    ```viml\n    let g:rooter_change_directory_for_non_project_files = 'current'\n    ```\n\n- Change to home directory.\n\n    ```viml\n    let g:rooter_change_directory_for_non_project_files = 'home'\n    ```\n\n\n### Ignored files\n\nBy default Rooter does not take into account `.gitignore`.\n\nTo make Rooter aware of ignored files:\n\n```viml\nlet g:rooter_ignore = 1\n```\n\nWhen this is set, and the file in question is ignored by git, Rooter acts as if `.git` is not in `g:rooter_patterns`.\n\nSupport for other VCSs' ignores could be added.\n\n\n### Running automatically or manually\n\nTo toggle between automatic and manual behaviour, use `:RooterToggle`.\n\nTo make Rooter start in manual mode:\n\n```viml\nlet g:rooter_manual_only = 1\n```\n\n\n### Miscellaneous\n\nBy default vim-rooter uses `:cd` to change directory.  To use `:lcd` or `:tcd` instead:\n\n```viml\nlet g:rooter_cd_cmd = 'lcd'\n```\n\nTo stop Rooter echoing the project directory:\n\n```viml\nlet g:rooter_silent_chdir = 1\n```\n\nBy default Rooter doesn't resolve symbolic links in the file or directory which triggers it.  To do so:\n\n```viml\nlet g:rooter_resolve_links = 1\n```\n\n\n## Using root-finding functionality in other scripts\n\nThe public function `FindRootDirectory()` returns the absolute path to the root directory as a string, if a root directory is found, or an empty string otherwise.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fairblade%2Fvim-rooter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fairblade%2Fvim-rooter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fairblade%2Fvim-rooter/lists"}