Skip to content

Commit

Permalink
Add 'tracked' context to git-info
Browse files Browse the repository at this point in the history
* add :prezto:module:git:info:tracked (%t) to format dirty tracked file count
  • Loading branch information
Zoybean committed Dec 26, 2018
1 parent a338cba commit da3dce9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/git/functions/git-info
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ function git-info {
local dirty=0
local dirty_format
local dirty_formatted
local tracked=0
local tracked_format
local tracked_formatted
local ignore_submodules
local indexed=0
local indexed_format
Expand Down Expand Up @@ -403,6 +406,13 @@ function git-info {
fi
fi

# Format tracked.
(( tracked = dirty - untracked ))
if (( tracked > 0 )); then
zstyle -s ':prezto:module:git:info:tracked' format 'tracked_format'
zformat -f tracked_formatted "$tracked_format" "t:$tracked"
fi

# Format dirty and clean.
if (( dirty > 0 )); then
zstyle -s ':prezto:module:git:info:dirty' format 'dirty_format'
Expand Down Expand Up @@ -432,6 +442,7 @@ function git-info {
"s:$action_formatted" \
"S:$stashed_formatted" \
"U:$unmerged_formatted" \
"t:$tracked_formatted" \
"u:$untracked_formatted"
git_info[$info_format]="$REPLY"
done
Expand Down

0 comments on commit da3dce9

Please sign in to comment.