mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-12 01:52:31 +01:00
This patch adds the git library function for building a
short string that represents the output of git diff --numstat.
This gives theme designers the ability to add the
Number of files changed, number of lines added and number of
lines removed in their prompt for a git repository, while the user's
current working directory is in the git repo.
The new function supports prefix and suffix for each of the
options, files changed, lines added and lines removed.
To colorize the output, you can do something like this in your
theme file
ZSH_THEME_GIT_FILES_CHANGED_PREFIX="%{$fg[yellow]%}"
ZSH_THEME_GIT_FILES_CHANGED_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_LINES_ADDED_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_LINES_ADDED_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_LINES_REMOVED_PREFIX="%{$fg[red]%}"
ZSH_THEME_GIT_LINES_REMOVED_SUFFIX="%{$fg[blue]%}"
For example, if there are
3 files changed, 10 lines added and no lines removed you will get
3f:10+
1 files changed, 20 lines added and 6 lines removed:
1f:20+:6-
|
||
|---|---|---|
| .. | ||
| bzr.zsh | ||
| cli.zsh | ||
| clipboard.zsh | ||
| compfix.zsh | ||
| completion.zsh | ||
| correction.zsh | ||
| diagnostics.zsh | ||
| directories.zsh | ||
| functions.zsh | ||
| git.zsh | ||
| grep.zsh | ||
| history.zsh | ||
| key-bindings.zsh | ||
| misc.zsh | ||
| nvm.zsh | ||
| prompt_info_functions.zsh | ||
| spectrum.zsh | ||
| termsupport.zsh | ||
| theme-and-appearance.zsh | ||