Added the clean flag to git prompt as well as dirty
This commit is contained in:
parent
93d3ba4531
commit
c36a3ce189
1 changed files with 12 additions and 0 deletions
|
@ -28,6 +28,9 @@
|
||||||
# # %d - Indicator to notify of deleted files.
|
# # %d - Indicator to notify of deleted files.
|
||||||
# zstyle ':omz:module:git' deleted 'deleted:%d'
|
# zstyle ':omz:module:git' deleted 'deleted:%d'
|
||||||
#
|
#
|
||||||
|
# # %C - Indicator to notify of no dirty files.
|
||||||
|
# zstyle ':omz:module:git' clean 'clean:%C'
|
||||||
|
#
|
||||||
# # %D - Indicator to notify of dirty files.
|
# # %D - Indicator to notify of dirty files.
|
||||||
# zstyle ':omz:module:git' dirty 'dirty:%D'
|
# zstyle ':omz:module:git' dirty 'dirty:%D'
|
||||||
#
|
#
|
||||||
|
@ -195,6 +198,8 @@ function git-info {
|
||||||
local dirty=0
|
local dirty=0
|
||||||
local dirty_format
|
local dirty_format
|
||||||
local dirty_formatted
|
local dirty_formatted
|
||||||
|
local clean_format
|
||||||
|
local clean_formatted
|
||||||
local ignore_submodule
|
local ignore_submodule
|
||||||
local -A info_formats
|
local -A info_formats
|
||||||
local info_format
|
local info_format
|
||||||
|
@ -381,12 +386,19 @@ function git-info {
|
||||||
zformat -f dirty_formatted "$dirty_format" "D:$dirty"
|
zformat -f dirty_formatted "$dirty_format" "D:$dirty"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Format clean.
|
||||||
|
if (( $dirty == 0 )); then
|
||||||
|
zstyle -s ':omz:module:git' clean 'clean_format'
|
||||||
|
zformat -f clean_formatted "$clean_format" "C:$dirty"
|
||||||
|
fi
|
||||||
|
|
||||||
# Format info.
|
# Format info.
|
||||||
zstyle -a ':omz:module:git' info 'info_formats'
|
zstyle -a ':omz:module:git' info 'info_formats'
|
||||||
for info_format in ${(k)info_formats}; do
|
for info_format in ${(k)info_formats}; do
|
||||||
zformat -f REPLY "$info_formats[$info_format]" \
|
zformat -f REPLY "$info_formats[$info_format]" \
|
||||||
"A:$ahead_formatted" \
|
"A:$ahead_formatted" \
|
||||||
"B:$behind_formatted" \
|
"B:$behind_formatted" \
|
||||||
|
"C:$clean_formatted" \
|
||||||
"D:$dirty_formatted" \
|
"D:$dirty_formatted" \
|
||||||
"R:$remote_formatted" \
|
"R:$remote_formatted" \
|
||||||
"S:$stashed_formatted" \
|
"S:$stashed_formatted" \
|
||||||
|
|
Loading…
Add table
Reference in a new issue