https://github.com/permafrost-dev/compress-path
Compress a path to a shorter string, for use in terminal prompts.
https://github.com/permafrost-dev/compress-path
cli cwd go prompt terminal zsh
Last synced: 3 months ago
JSON representation
Compress a path to a shorter string, for use in terminal prompts.
- Host: GitHub
- URL: https://github.com/permafrost-dev/compress-path
- Owner: permafrost-dev
- License: mit
- Created: 2022-10-06T12:50:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-05-12T19:44:29.000Z (about 1 year ago)
- Last Synced: 2025-05-12T20:49:50.483Z (about 1 year ago)
- Topics: cli, cwd, go, prompt, terminal, zsh
- Language: Go
- Homepage:
- Size: 309 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# compress-path
[](https://github.com/permafrost-dev/compress-path/releases/latest) [](https://goreportcard.com/report/github.com/permafrost-dev/compress-path) [](https://codeclimate.com/github/permafrost-dev/compress-path/maintainability) 
---
Compress and abbreviate the parts of a pathname into a shorter overall string; for use within a Zsh prompt. Adds some minor styling, such as bold text for the last path section (the current directory).

## Setup
Download and extract `compress-path` to your `$PATH`. Then, add the following to your `.zshrc`:
```bash
export PS1='$(compress-path) >'
```
If you're using `oh-my-zsh`, edit your `~/.oh-my-zsh/your-theme.zsh-theme` and modify the `prompt_dir` (or similar) function to look something like this:
```bash
prompt_dir() {
prompt_segment blue $CURRENT_FG $(compress-path)
}
```
## Building from source
`compress-path` prefers `task` for running tasks - see [taskfile.dev](https://taskfile.dev) for more information. If you don't have `task` installed, you can use `make` instead.
```bash
task build
# or
make build
```
---
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Patrick Organ](https://github.com/patinthehat)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.