An oh-my-zsh plugin that automatically updates your prompt when git status changes, using fswatch to monitor repository files in real-time.
It solves the problem of slow shell prompts in large Git repositories by avoiding shell-based file system scanning. Instead, it uses a dedicated, high-performance file system watcher (fswatch) to instantly detect changes and refresh the prompt on demand.
- Real-time Prompt Updates: Your prompt refreshes instantly when you change branches, commit, or modify files.
- Efficient: Uses
fswatchfor low-latency monitoring, avoiding slow shell commands in your prompt. - Git-Aware: Respects your
.gitignorefiles and automatically re-indexes when they change. - Stable: Won't clutter your
jobsoutput or leave orphaned processes behind. - Heavily Tested: A comprehensive test suite validates functionality in a real shell environment to guarantee reliability.
- oh-my-zsh
- fswatch (e.g.,
brew install fswatch) - A prompt that supports
zle reset-prompt(like Starship, Powerlevel10k, etc.) - macOS or Linux
-
Clone the repository:
git clone https://github.com/shields/git-prompt-watcher.git ~/.oh-my-zsh/custom/plugins/git-prompt-watcher -
Add the plugin to your
.zshrc:plugins=(... git-prompt-watcher)
-
Restart your shell.
The plugin runs fswatch in the background to monitor key Git files (.git/index, .git/HEAD, .git/refs), your .gitignore files, and the working directory. When a change is detected, it sends a SIGUSR1 signal to the parent Zsh process, which triggers zle reset-prompt to redraw your prompt.
Contributions are welcome! The plugin is rigorously tested using a custom-built test suite in Rust. For more details on testing and development, please see CONTRIBUTING.md.
Licensed under the Apache License, Version 2.0. See LICENSE for details.