{"id":29353613,"url":"https://github.com/pp5x/zsh-vcs-prompt","last_synced_at":"2026-04-29T23:04:26.201Z","repository":{"id":303400576,"uuid":"1015351501","full_name":"pp5x/zsh-vcs-prompt","owner":"pp5x","description":"Fast, intelligent zsh prompt with VCS-aware path display and smart truncation","archived":false,"fork":false,"pushed_at":"2025-07-07T11:53:25.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-07T12:43:15.154Z","etag":null,"topics":["git","prompt","shell","terminal","vcs","zsh"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pp5x.png","metadata":{"files":{"readme":"README.md","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,"zenodo":null}},"created_at":"2025-07-07T11:22:49.000Z","updated_at":"2025-07-07T11:53:28.000Z","dependencies_parsed_at":"2025-07-07T12:43:16.940Z","dependency_job_id":"e7caf73f-05f9-43da-b702-e8d5ecd53d36","html_url":"https://github.com/pp5x/zsh-vcs-prompt","commit_stats":null,"previous_names":["pp5x/zsh-vcs-prompt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pp5x/zsh-vcs-prompt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pp5x%2Fzsh-vcs-prompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pp5x%2Fzsh-vcs-prompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pp5x%2Fzsh-vcs-prompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pp5x%2Fzsh-vcs-prompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pp5x","download_url":"https://codeload.github.com/pp5x/zsh-vcs-prompt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pp5x%2Fzsh-vcs-prompt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32447312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["git","prompt","shell","terminal","vcs","zsh"],"created_at":"2025-07-09T02:02:31.441Z","updated_at":"2026-04-29T23:04:26.197Z","avatar_url":"https://github.com/pp5x.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZSH VCS Prompt\n\nA fast, intelligent zsh prompt that provides VCS-aware path display with smart truncation and multi-level repository support.\n\n## Features\n\n- **Multi-VCS Support**: Detects Git (`.git`), Jujutsu (`.jj`), and Repo (`.repo`) repositories\n- **Smart Path Truncation**: Non-final path components are truncated to single letters (e.g., `/usr/local/bin` → `/u/l/bin`)\n- **Nested VCS Detection**: Handles multiple nested VCS repositories with proper coloring\n- **HOME Directory Support**: Displays `~` for home directory paths\n- **Performance Optimized**: Lightweight implementation for fast prompt rendering\n- **Color-Coded**: Different colors for different VCS types:\n  - **Git**: Blue\n  - **Jujutsu**: Magenta  \n  - **Repo**: Green\n\n## Installation\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/yourusername/zsh-vcs-prompt.git\n   cd zsh-vcs-prompt\n   ```\n\n2. Source the script in your `.zshrc`:\n   ```bash\n   source /path/to/zsh-vcs-prompt/rel_vcs_prompt.zsh\n   ```\n\n3. Reload your shell:\n   ```bash\n   source ~/.zshrc\n   ```\n\n## Examples\n\n### Basic VCS Detection\n```bash\n# In a git repository\n~/myproject $ \n# Displays: myproject (colored blue)\n\n# In a subdirectory\n~/myproject/src/components $ \n# Displays: myproject/s/components (myproject colored blue)\n```\n\n### Nested VCS Repositories\n```bash\n# Multiple VCS levels\n~/company/teams/frontend/dashboard/src $ \n# Where: company/.git, dashboard/.jj\n# Displays: company/t/f/dashboard/src (company=blue, dashboard=magenta)\n```\n\n### Path Truncation\n```bash\n# Long paths get truncated\n~/documents/projects/website/src/components/common $ \n# Displays: ~/d/p/w/s/c/common\n\n# System paths\n/usr/local/bin $ \n# Displays: /u/l/bin\n```\n\n### Inside VCS Directories\n```bash\n# Working inside .git directory\n~/myproject/.git/hooks $ \n# Displays: myproject/.g/hooks (myproject colored blue)\n```\n\n## How It Works\n\n### VCS Detection\nThe prompt walks up the directory tree from the current location, detecting VCS directories:\n- `.git` (Git repositories)\n- `.jj` (Jujutsu repositories) \n- `.repo` (Repo tool repositories)\n\n### Path Processing\n1. **VCS Mode**: When in a VCS repository, the outermost VCS root becomes the base\n2. **Path Truncation**: All non-final directory components are truncated to their first letter\n3. **Dotfile Handling**: Dotfiles like `.config` become `.c`\n4. **Coloring**: VCS root directories are colored according to their type\n\n### Nested VCS Support\nWhen multiple VCS repositories are nested, each VCS root directory gets colored appropriately while maintaining the path structure.\n\n## Testing\n\nThe project includes comprehensive test coverage using [zunit](https://github.com/zunit-zsh/zunit):\n\n```bash\n# Install zunit (if not already installed)\n# Run tests\nzunit run tests/vcs_prompt.zunit\n```\n\n### Test Categories\n- **Unit Tests**: Individual feature testing (VCS detection, path truncation, HOME handling)\n- **Integration Tests**: Feature combinations (VCS + truncation, nested VCS)\n- **Complex Scenarios**: Edge cases (duplicate names, inside VCS directories, special cases)\n\n## Configuration\n\nThe prompt uses these color codes by default:\n- Git: `%F{blue}`\n- Jujutsu: `%F{magenta}`\n- Repo: `%F{green}`\n\nTo customize colors, modify the `get_vcs_color()` function in `rel_vcs_prompt.zsh`.\n\n## Performance\n\nThis implementation is optimized for speed:\n- Minimal external command usage\n- Efficient path traversal\n- Cached VCS detection\n- Lightweight string operations\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Ensure all tests pass\n5. Submit a pull request\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Changelog\n\n### Latest\n- Comprehensive test suite with 22 test cases\n- Support for inside VCS directory navigation\n- Improved nested VCS detection algorithm\n- Enhanced path truncation logic\n\n### Previous Versions\n- Added Jujutsu (`.jj`) support\n- Implemented Repo tool (`.repo`) support  \n- Added HOME directory handling\n- Initial Git support and path truncation","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpp5x%2Fzsh-vcs-prompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpp5x%2Fzsh-vcs-prompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpp5x%2Fzsh-vcs-prompt/lists"}