π a configurable theme for zsh, inspired by zeta-zsh-theme and pure.
-
Highlights environment changes
Username and host changes the style for special environments: root, remote, container
-
Async VCS status
Background process, don't blocks your workflow
-
Execution time
Show human readable execution time for long run command
-
Python
Virtualenv prompt is included
-
Show the error
Prompt indicator changes whether the last run success (π/π₯)
-
Configurable
Read the configuration section below
clone this repo into $ZSH_CUSTOM:
cd ${ZSH_CUSTOM:-"~/.oh-my-zsh/custom"}/themes
git clone [email protected]:tzing/clover.zsh-theme.git cloverthen change the theme:
ZSH_THEME="clover/clover"zinit light tzing/clover.zsh-themeclone this repo to somewhere you like:
git clone [email protected]:tzing/clover.zsh-theme.git <PATH>and source the main script in your .zshrc
source <PATH>/clover.zsh-themeThis theme reads the configurations from zstyle. All context name must be prefixed with :prompt:clover:. Styles are always configurable, and for some components you could also customized the symbols.
Here's a disgram that shows context names:
β---------------------------------------------------------------------- user
| β----------------------------------------------------------------- host
| | β------------------------------------------------------- path
| | | β----------------------------------- vcs:branch
| | | | β------------------------------ vcs:status (read details below)
| | | | | β------------------- execution-time
| | | | | | β-------------- current-time
# user@hostname: ~/clover.zsh-theme <main ββ‘> 10s (12:00:00 +0800)
(.venv) π
| β----------------------------------------------------------------- prompt
β------------------------------------------------------------------------ virtualenv
Note
VCS information (:prompt:clover:vcs:*) are evaluated in background process, which is forked in first precmd run.
Runtime zstyle settings will not take effect. But you could still change the style in .zshrc.
Run zstyle command with the key style. And the value could be the visual effect expresssion in zsh prompt expansion.
An example of setting the path to bold cyan:
zstyle :prompt:clover:path style '%B%F{cyan}'Use key symbol for customization.
For example, setting default prompt symbol to $:
zstyle :prompt:clover:prompt:default symbol '$'| context name | usage | default style | default symbol |
|---|---|---|---|
current-time |
Current time | blue | |
execution-time |
Last execution time | 242 | |
host:container |
Host name when it is inside a container | bold white text in magenta bg | |
host:default |
Host name | bold cyan | |
host:remote |
Host name when it is remote session | bold white text in blue bg | |
path |
Current path | bold yellow | |
prompt:default |
Prompt color | green | π |
prompt:fail |
Prompt color when last run failed | red | π₯ |
user:default |
User name | bold green | |
user:root |
User name when current user is root |
bold green | |
vcs:action |
Current action in VCS | red | |
vcs:branch |
Current branch name | bold blue | |
vcs:status:ahead |
[Git only] Current branch is ahead of remote | cyan | β‘ |
vcs:status:behind |
[Git only] Current branch is behind of remote | magenta | β£ |
vcs:status:clean |
[Git only] Work tree is clean | green | β |
vcs:status:diverge |
[Git only] Diverged changes found | red | β |
vcs:status:staged |
Found staged changes in current repo | green | β‘ |
vcs:status:unstaged |
Found unstaged changes in current repo | magenta | β± |
vcs:status:untracked |
[Git only] Found untracked file | 242 | ? |
virtualenv |
Python virtualenv prompt prefix | 242 |
There are some other settings could be changed through zstyle too:
| context name | key | usage | default |
|---|---|---|---|
current-time |
format |
Format for current time. See strftime(3) for more details. | %H:%M:%S %z |
execution-time |
min-display-second |
Only show execution time when last run is longer than this time. | 5 |
