This is a Zsh prompt style for my own use, inspired by Oh My Zsh built-in theme fox and a popular Zsh theme Powerlevel10k.
To activate the prompt, source prompt.zsh
in your .zshrc
.
The prompt
- Is in a colorful style.
- Always shows the current user, working directory and time.
- Hides hostname when working locally.
- Shows git status when in a git repo.
- Shows virtualenv name when in a virtualenv.
- Shows the exit code when the last command returns an error.
- Truncates path when the prompt is too long.
The prompt uses gitstatus by romkatv to acquire git status. You need to install it yourself.
With Homebrew:
brew install romkatv/gitstatus/gitstatus
source $(brew --prefix gitstatus)/gitstatus.prompt.zsh
Or manually:
git clone --depth=1 https://github.com/romkatv/gitstatus.git ~/gitstatus
source ~/gitstatus/gitstatus.prompt.zsh
Edit prompt.zsh
to correctly source the plugin.
- 2024/4/20: Added an optional one-line style. Set
PROMPT_ONE_LINE
to enable.