Rename git-info zstyle patterns

This commit is contained in:
Sorin Ionescu 2012-10-01 22:12:14 -04:00
parent f12c24e76e
commit 4c116cb4d2
2 changed files with 31 additions and 31 deletions

View File

@ -266,21 +266,21 @@ function git-info {
# Format commit.
commit="$(git rev-parse HEAD 2> /dev/null)"
if [[ -n "$commit" ]]; then
zstyle -s ':prezto:module:git' commit 'commit_format'
zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
zformat -f commit_formatted "$commit_format" "c:$commit"
fi
# Format stashed.
if [[ -f "$(git-dir)/refs/stash" ]]; then
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
zstyle -s ':prezto:module:git' stashed 'stashed_format'
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
fi
# Format action.
action="$(_git-action)"
if [[ -n "$action" ]]; then
zstyle -s ':prezto:module:git' action 'action_format'
zstyle -s ':prezto:module:git:info:action' format 'action_format'
zformat -f action_formatted "$action_format" "s:$action"
fi
@ -301,13 +301,13 @@ function git-info {
# Format branch.
branch="${$(git symbolic-ref -q HEAD)##refs/heads/}"
if [[ -n "$branch" ]]; then
zstyle -s ':prezto:module:git' branch 'branch_format'
zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
zformat -f branch_formatted "$branch_format" "b:$branch"
# Format remote.
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
if [[ -n "$remote" ]]; then
zstyle -s ':prezto:module:git' remote 'remote_format'
zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
zformat -f remote_formatted "$remote_format" "R:$remote"
# Get ahead and behind counts.
@ -316,14 +316,14 @@ function git-info {
# Format ahead.
ahead="$ahead_and_behind[(w)1]"
if (( $ahead > 0 )); then
zstyle -s ':prezto:module:git' ahead 'ahead_format'
zstyle -s ':prezto:module:git:info:ahead' format 'ahead_format'
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
fi
# Format behind.
behind="$ahead_and_behind[(w)2]"
if (( $behind > 0 )); then
zstyle -s ':prezto:module:git' behind 'behind_format'
zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
zformat -f behind_formatted "$behind_format" "B:$behind"
fi
fi
@ -331,57 +331,57 @@ function git-info {
# Format position.
position="$(git describe --contains --all HEAD 2> /dev/null)"
if [[ -n "$position" ]]; then
zstyle -s ':prezto:module:git' position 'position_format'
zstyle -s ':prezto:module:git:info:position' format 'position_format'
zformat -f position_formatted "$position_format" "p:$position"
fi
fi
# Format added.
if (( $added > 0 )); then
zstyle -s ':prezto:module:git' added 'added_format'
zstyle -s ':prezto:module:git:info:added' format 'added_format'
zformat -f added_formatted "$added_format" "a:$added_format"
fi
# Format deleted.
if (( $deleted > 0 )); then
zstyle -s ':prezto:module:git' deleted 'deleted_format'
zstyle -s ':prezto:module:git:info:deleted' format 'deleted_format'
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
fi
# Format modified.
if (( $modified > 0 )); then
zstyle -s ':prezto:module:git' modified 'modified_format'
zstyle -s ':prezto:module:git:info:modified' format 'modified_format'
zformat -f modified_formatted "$modified_format" "m:$modified"
fi
# Format renamed.
if (( $renamed > 0 )); then
zstyle -s ':prezto:module:git' renamed 'renamed_format'
zstyle -s ':prezto:module:git:info:renamed' format 'renamed_format'
zformat -f renamed_formatted "$renamed_format" "r:$renamed"
fi
# Format unmerged.
if (( $unmerged > 0 )); then
zstyle -s ':prezto:module:git' unmerged 'unmerged_format'
zstyle -s ':prezto:module:git:info:unmerged' format 'unmerged_format'
zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged"
fi
# Format untracked.
if (( $untracked > 0 )); then
zstyle -s ':prezto:module:git' untracked 'untracked_format'
zstyle -s ':prezto:module:git:info:untracked' format 'untracked_format'
zformat -f untracked_formatted "$untracked_format" "u:$untracked"
fi
# Format dirty and clean.
if (( $dirty > 0 )); then
zstyle -s ':prezto:module:git' dirty 'dirty_format'
zstyle -s ':prezto:module:git:info:dirty' format 'dirty_format'
zformat -f dirty_formatted "$dirty_format" "D:$dirty"
else
zstyle -s ':prezto:module:git' clean 'clean_formatted'
zstyle -s ':prezto:module:git:info:clean' format 'clean_formatted'
fi
# Format info.
zstyle -a ':prezto:module:git' info 'info_formats'
zstyle -a ':prezto:module:git:info:keys' format 'info_formats'
for info_format in ${(k)info_formats}; do
zformat -f REPLY "$info_formats[$info_format]" \
"A:$ahead_formatted" \

View File

@ -50,20 +50,20 @@ function prompt_sorin_setup {
zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{red}%F{yellow}%F{green}%f%b'
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{red}♺%f'
zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{green}%F{yellow}%F{red}%f%b'
zstyle ':prezto:module:git' action ':%%B%F{yellow}%s%f%%b'
zstyle ':prezto:module:git' added ' %%B%F{green}✚%f%%b'
zstyle ':prezto:module:git' ahead ' %%B%F{yellow}⬆%f%%b'
zstyle ':prezto:module:git' behind ' %%B%F{yellow}⬇%f%%b'
zstyle ':prezto:module:git' branch ':%F{green}%b%f'
zstyle ':prezto:module:git' commit ':%F{green}%.7c%f'
zstyle ':prezto:module:git' deleted ' %%B%F{red}✖%f%%b'
zstyle ':prezto:module:git' modified ' %%B%F{blue}✱%f%%b'
zstyle ':prezto:module:git' position ':%F{green}%p%f'
zstyle ':prezto:module:git' renamed ' %%B%F{magenta}➜%f%%b'
zstyle ':prezto:module:git' stashed ' %%B%F{cyan}✭%f%%b'
zstyle ':prezto:module:git' unmerged ' %%B%F{yellow}═%f%%b'
zstyle ':prezto:module:git' untracked ' %%B%F{white}◼%f%%b'
zstyle ':prezto:module:git' info \
zstyle ':prezto:module:git:info:action' format ':%%B%F{yellow}%s%f%%b'
zstyle ':prezto:module:git:info:added' format ' %%B%F{green}✚%f%%b'
zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}⬆%f%%b'
zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}⬇%f%%b'
zstyle ':prezto:module:git:info:branch' format ':%F{green}%b%f'
zstyle ':prezto:module:git:info:commit' format ':%F{green}%.7c%f'
zstyle ':prezto:module:git:info:deleted' format ' %%B%F{red}✖%f%%b'
zstyle ':prezto:module:git:info:modified' format ' %%B%F{blue}✱%f%%b'
zstyle ':prezto:module:git:info:position' format ':%F{green}%p%f'
zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b'
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}✭%f%%b'
zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}═%f%%b'
zstyle ':prezto:module:git:info:untracked' format ' %%B%F{white}◼%f%%b'
zstyle ':prezto:module:git:info:keys' format \
'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \
'rprompt' '%A%B%S%a%d%m%r%U%u'