1
0
Fork 0

Shorten git zstyle namespace

pull/124/head
Sorin Ionescu 13 years ago
parent 900c4d8f3f
commit 48dcd2f723

@ -206,9 +206,9 @@ function git-info {
# Ignore submodule status.
zstyle -b \
':omz:module:git:prompt:ignore' submodule 'ignore_submodule'
':omz:module:git:ignore' submodule 'ignore_submodule'
zstyle -s \
':omz:module:git:prompt:ignore:submodule' when 'ignore_submodule_when'
':omz:module:git:ignore:submodule' when 'ignore_submodule_when'
if is-true "$ignore_submodule"; then
status_cmd+=" --ignore-submodules=${ignore_submodule_when:-all}"
fi
@ -216,21 +216,21 @@ function git-info {
# Format commit.
commit="$(git rev-parse HEAD 2> /dev/null)"
if [[ -n "$commit" ]]; then
zstyle -s ':omz:module:git:prompt' commit 'commit_format'
zstyle -s ':omz:module:git' commit '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)"
zstyle -s ':omz:module:git:prompt' stashed 'stashed_format'
zstyle -s ':omz:module:git' stashed 'stashed_format'
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
fi
# Format action.
action="$(_git-action)"
if [[ -n "$action" ]]; then
zstyle -s ':omz:module:git:prompt' action 'action_format'
zstyle -s ':omz:module:git' action 'action_format'
zformat -f action_formatted "$action_format" "s:$action"
fi
@ -251,13 +251,13 @@ function git-info {
# Format branch.
branch="${$(git symbolic-ref -q HEAD)##refs/heads/}"
if [[ -n "$branch" ]]; then
zstyle -s ':omz:module:git:prompt' branch 'branch_format'
zstyle -s ':omz:module:git' branch '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 ':omz:module:git:prompt' remote 'remote_format'
zstyle -s ':omz:module:git' remote 'remote_format'
zformat -f remote_formatted "$remote_format" "R:$remote"
# Get ahead and behind counts.
@ -266,14 +266,14 @@ function git-info {
# Format ahead.
ahead="$ahead_and_behind[(w)1]"
if (( $ahead > 0 )); then
zstyle -s ':omz:module:git:prompt' ahead 'ahead_format'
zstyle -s ':omz:module:git' ahead '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 ':omz:module:git:prompt' behind 'behind_format'
zstyle -s ':omz:module:git' behind 'behind_format'
zformat -f behind_formatted "$behind_format" "B:$behind"
fi
fi
@ -281,56 +281,56 @@ function git-info {
# Format position.
position="$(git describe --contains --all HEAD 2> /dev/null)"
if [[ -n "$position" ]]; then
zstyle -s ':omz:plugin:git:prompt' position 'position_format'
zstyle -s ':omz:module:git:prompt' position 'position_format'
zformat -f position_formatted "$position_format" "p:$position"
fi
fi
# Format added.
if (( $added > 0 )); then
zstyle -s ':omz:module:git:prompt' added 'added_format'
zstyle -s ':omz:module:git' added 'added_format'
zformat -f added_formatted "$added_format" "a:$added_format"
fi
# Format deleted.
if (( $deleted > 0 )); then
zstyle -s ':omz:module:git:prompt' deleted 'deleted_format'
zstyle -s ':omz:module:git' deleted 'deleted_format'
zformat -f deleted_formatted "$deleted_format" "d:$deleted_format"
fi
# Format modified.
if (( $modified > 0 )); then
zstyle -s ':omz:module:git:prompt' modified 'modified_format'
zstyle -s ':omz:module:git' modified 'modified_format'
zformat -f modified_formatted "$modified_format" "m:$modified"
fi
# Format renamed.
if (( $renamed > 0 )); then
zstyle -s ':omz:module:git:prompt' renamed 'renamed_format'
zstyle -s ':omz:module:git' renamed 'renamed_format'
zformat -f renamed_formatted "$renamed_format" "r:$renamed"
fi
# Format unmerged.
if (( $unmerged > 0 )); then
zstyle -s ':omz:module:git:prompt' unmerged 'unmerged_format'
zstyle -s ':omz:module:git' unmerged 'unmerged_format'
zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged"
fi
# Format untracked.
if (( $untracked > 0 )); then
zstyle -s ':omz:module:git:prompt' untracked 'untracked_format'
zstyle -s ':omz:module:git' untracked 'untracked_format'
zformat -f untracked_formatted "$untracked_format" "u:$untracked"
fi
# Format dirty.
if (( $dirty > 0 )); then
zstyle -s ':omz:module:git:prompt' dirty 'dirty_format'
zstyle -s ':omz:module:git' dirty 'dirty_format'
zformat -f dirty_formatted "$dirty_format" "D:$dirty"
fi
# Format prompts.
zstyle -s ':omz:module:git:prompt' prompt 'prompt_format'
zstyle -s ':omz:module:git:prompt' rprompt 'rprompt_format'
zstyle -s ':omz:module:git' prompt 'prompt_format'
zstyle -s ':omz:module:git' rprompt 'rprompt_format'
git_info_vars=(
git_prompt_info "$prompt_format"

@ -6,59 +6,59 @@
#
# %s - Special action name (am, merge, rebase).
zstyle ':omz:module:git:prompt' action 'action:%s'
zstyle ':omz:module:git' action 'action:%s'
# %a - Indicator to notify of added files.
zstyle ':omz:module:git:prompt' added 'added:%a'
zstyle ':omz:module:git' added 'added:%a'
# %A - Indicator to notify of ahead branch.
zstyle ':omz:module:git:prompt' ahead 'ahead:%A'
zstyle ':omz:module:git' ahead 'ahead:%A'
# %B - Indicator to notify of behind branch.
zstyle ':omz:module:git:prompt' behind 'behind:%B'
zstyle ':omz:module:git' behind 'behind:%B'
# %b - Branch name.
zstyle ':omz:module:git:prompt' branch 'branch:%b'
zstyle ':omz:module:git' branch 'branch:%b'
# %c - SHA-1 hash.
zstyle ':omz:module:git:prompt' commit 'commit:%c'
zstyle ':omz:module:git' commit 'commit:%c'
# %d - Indicator to notify of deleted files.
zstyle ':omz:module:git:prompt' deleted 'deleted:%d'
zstyle ':omz:module:git' deleted 'deleted:%d'
# %D - Indicator to notify of dirty files.
zstyle ':omz:module:git:prompt' dirty 'dirty:%D'
zstyle ':omz:module:git' dirty 'dirty:%D'
# %m - Indicator to notify of modified files.
zstyle ':omz:module:git:prompt' modified 'modified:%m'
zstyle ':omz:module:git' modified 'modified:%m'
# %p - HEAD position in relation to the nearest branch, remote, tag.
zstyle ':omz:module:git:prompt' position 'position:%p'
# %R - Remote name.
zstyle ':omz:module:git:prompt' remote 'remote:%R'
zstyle ':omz:module:git' remote 'remote:%R'
# %r - Indicator to notify of renamed files.
zstyle ':omz:module:git:prompt' renamed 'renamed:%r'
zstyle ':omz:module:git' renamed 'renamed:%r'
# %S - Indicator to notify of stashed files.
zstyle ':omz:module:git:prompt' stashed 'stashed:%S'
zstyle ':omz:module:git' stashed 'stashed:%S'
# %U - Indicator to notify of unmerged files.
zstyle ':omz:module:git:prompt' unmerged 'unmerged:%U'
zstyle ':omz:module:git' unmerged 'unmerged:%U'
# %u - Indicator to notify of untracked files.
zstyle ':omz:module:git:prompt' untracked 'untracked:%u'
zstyle ':omz:module:git' untracked 'untracked:%u'
# Left prompt.
zstyle ':omz:module:git:prompt' prompt ' git:(%b %D)'
zstyle ':omz:module:git' prompt ' git:(%b %D)'
# Right prompt.
zstyle ':omz:module:git:prompt' rprompt ''
zstyle ':omz:module:git' rprompt ''
# Ignore submodule.
zstyle ':omz:module:git:prompt:ignore' submodule 'no'
zstyle ':omz:module:git:ignore' submodule 'no'
# Ignore submodule when it is 'dirty', 'untracked', 'all', or 'none'.
zstyle ':omz:module:git:prompt:ignore:submodule' when 'all'
zstyle ':omz:module:git:ignore:submodule' when 'all'

@ -28,21 +28,21 @@ function prompt_sorin_setup {
zstyle ':omz:module:editor' completing '%B%F{red}...%f%b'
zstyle ':omz:module:editor:keymap' primary ''
zstyle ':omz:module:editor:keymap' alternate ' %F{yellow}%f%B%F{red}%f%b%F{red}%f'
zstyle ':omz:module:git:prompt' action ':%%B%F{yellow}%s%f%%b'
zstyle ':omz:module:git:prompt' added ' %%B%F{green}✚%f%%b'
zstyle ':omz:module:git:prompt' ahead ' %%B%F{yellow}⬆%f%%b'
zstyle ':omz:module:git:prompt' behind ' %%B%F{yellow}⬇%f%%b'
zstyle ':omz:module:git:prompt' branch ':%F{red}%b%f'
zstyle ':omz:module:git:prompt' commit ':%F{green}%.7c%f'
zstyle ':omz:module:git:prompt' deleted ' %%B%F{red}✖%f%%b'
zstyle ':omz:module:git:prompt' modified ' %%B%F{blue}✱%f%%b'
zstyle ':omz:module:git:prompt' position ':%F{green}%p%f'
zstyle ':omz:module:git:prompt' renamed ' %%B%F{magenta}➜%f%%b'
zstyle ':omz:module:git:prompt' stashed ' %%B%F{cyan}✭%f%%b'
zstyle ':omz:module:git:prompt' unmerged ' %%B%F{yellow}═%f%%b'
zstyle ':omz:module:git:prompt' untracked ' %%B%F{white}◼%f%%b'
zstyle ':omz:module:git:prompt' prompt ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s'
zstyle ':omz:module:git:prompt' rprompt '%A%B%S%a%d%m%r%U%u'
zstyle ':omz:module:git' action ':%%B%F{yellow}%s%f%%b'
zstyle ':omz:module:git' added ' %%B%F{green}✚%f%%b'
zstyle ':omz:module:git' ahead ' %%B%F{yellow}⬆%f%%b'
zstyle ':omz:module:git' behind ' %%B%F{yellow}⬇%f%%b'
zstyle ':omz:module:git' branch ':%F{red}%b%f'
zstyle ':omz:module:git' commit ':%F{green}%.7c%f'
zstyle ':omz:module:git' deleted ' %%B%F{red}✖%f%%b'
zstyle ':omz:module:git' modified ' %%B%F{blue}✱%f%%b'
zstyle ':omz:module:git' position ':%F{green}%p%f'
zstyle ':omz:module:git' renamed ' %%B%F{magenta}➜%f%%b'
zstyle ':omz:module:git' stashed ' %%B%F{cyan}✭%f%%b'
zstyle ':omz:module:git' unmerged ' %%B%F{yellow}═%f%%b'
zstyle ':omz:module:git' untracked ' %%B%F{white}◼%f%%b'
zstyle ':omz:module:git' prompt ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s'
zstyle ':omz:module:git' rprompt '%A%B%S%a%d%m%r%U%u'
PROMPT='%F{cyan}%1~%f${(e)git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}%f%b) '
RPROMPT='${editor_keymap_info}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_rprompt_info}'

Loading…
Cancel
Save