mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-23 03:27:59 +00:00
Fix a formatting bug introduced in cdb95f8
This commit is contained in:
parent
fe1d2ab77d
commit
5e5a7803b6
@ -17,7 +17,7 @@ function is-true() {
|
|||||||
|
|
||||||
# Prints the first non-empty string in the arguments array.
|
# Prints the first non-empty string in the arguments array.
|
||||||
function coalesce() {
|
function coalesce() {
|
||||||
for arg in "$argv[@]"; do
|
for arg in $argv; do
|
||||||
print "$arg"
|
print "$arg"
|
||||||
return 0
|
return 0
|
||||||
done
|
done
|
||||||
|
@ -218,9 +218,11 @@ function git-info() {
|
|||||||
# Get commit.
|
# Get commit.
|
||||||
commit="$(git rev-parse HEAD 2>/dev/null)"
|
commit="$(git rev-parse HEAD 2>/dev/null)"
|
||||||
|
|
||||||
# Format commit (short).
|
# Format commit.
|
||||||
zstyle -s ':omz:plugin:git:prompt' commit 'commit_format'
|
if [[ -n "$commit" ]]; then
|
||||||
zformat -f commit_formatted "$commit_format" "c:$commit"
|
zstyle -s ':omz:plugin:git:prompt' commit 'commit_format'
|
||||||
|
zformat -f commit_formatted "$commit_format" "c:$commit"
|
||||||
|
fi
|
||||||
|
|
||||||
# Stashed
|
# Stashed
|
||||||
if [[ -f "$(_git-dir)/refs/stash" ]]; then
|
if [[ -f "$(_git-dir)/refs/stash" ]]; then
|
||||||
@ -238,6 +240,8 @@ function git-info() {
|
|||||||
if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then
|
if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then
|
||||||
# Get action.
|
# Get action.
|
||||||
action="$(_git-action)"
|
action="$(_git-action)"
|
||||||
|
|
||||||
|
# Format action.
|
||||||
if [[ -n "$action" ]]; then
|
if [[ -n "$action" ]]; then
|
||||||
zstyle -s ':omz:plugin:git:prompt' action 'action_format'
|
zstyle -s ':omz:plugin:git:prompt' action 'action_format'
|
||||||
zformat -f action_formatted "$action_format" "s:$action"
|
zformat -f action_formatted "$action_format" "s:$action"
|
||||||
@ -287,11 +291,11 @@ function git-info() {
|
|||||||
done < <("${(z)status_cmd}" 2>/dev/null)
|
done < <("${(z)status_cmd}" 2>/dev/null)
|
||||||
|
|
||||||
# Format branch.
|
# Format branch.
|
||||||
zstyle -s ':omz:plugin:git:prompt' branch 'branch_format'
|
if [[ -n "$branch" ]]; then
|
||||||
zformat -f branch_formatted "$branch_format" "b:$branch"
|
zstyle -s ':omz:plugin:git:prompt' branch 'branch_format'
|
||||||
|
zformat -f branch_formatted "$branch_format" "b:$branch"
|
||||||
|
|
||||||
# Format remote.
|
# Format remote.
|
||||||
if [[ "$branch" != "$commit" ]]; then
|
|
||||||
if [[ -z "$remote" ]]; then
|
if [[ -z "$remote" ]]; then
|
||||||
remote="${$( \
|
remote="${$( \
|
||||||
git rev-parse \
|
git rev-parse \
|
||||||
|
@ -35,14 +35,14 @@ function prompt_sorin_setup() {
|
|||||||
zstyle ':omz:plugin:git:prompt' deleted ' %%B%F{red}✖%f%%b'
|
zstyle ':omz:plugin:git:prompt' deleted ' %%B%F{red}✖%f%%b'
|
||||||
zstyle ':omz:plugin:git:prompt' modified ' %%B%F{blue}✱%f%%b'
|
zstyle ':omz:plugin:git:prompt' modified ' %%B%F{blue}✱%f%%b'
|
||||||
zstyle ':omz:plugin:git:prompt' renamed ' %%B%F{magenta}➜%f%%b'
|
zstyle ':omz:plugin:git:prompt' renamed ' %%B%F{magenta}➜%f%%b'
|
||||||
zstyle ':omz:plugin:git:prompt' commit '%.7c'
|
zstyle ':omz:plugin:git:prompt' commit ':%F{red}%.7c%f'
|
||||||
zstyle ':omz:plugin:git:prompt' stashed ' %%B%F{cyan}✭%f%%b'
|
zstyle ':omz:plugin:git:prompt' stashed ' %%B%F{cyan}✭%f%%b'
|
||||||
zstyle ':omz:plugin:git:prompt' unmerged ' %%B%F{yellow}═%f%%b'
|
zstyle ':omz:plugin:git:prompt' unmerged ' %%B%F{yellow}═%f%%b'
|
||||||
zstyle ':omz:plugin:git:prompt' untracked ' %%B%F{white}◼%f%%b'
|
zstyle ':omz:plugin:git:prompt' untracked ' %%B%F{white}◼%f%%b'
|
||||||
|
zstyle ':omz:plugin:git:prompt' prompt ' %F{blue}git%f$(coalesce "%b" "%c")%s'
|
||||||
zstyle ':omz:plugin:git:prompt' rprompt '%A%B%S%a%d%m%r%U%u'
|
zstyle ':omz:plugin:git:prompt' rprompt '%A%B%S%a%d%m%r%U%u'
|
||||||
zstyle -e ':omz:plugin:git:prompt' prompt 'reply=(" %F{blue}git%f$(coalesce "%b" "%c")%s")'
|
|
||||||
|
|
||||||
PROMPT='%F{cyan}%1~%f${git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) '
|
PROMPT='%F{cyan}%1~%f${(e)git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) '
|
||||||
RPROMPT='%(?::%F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_rprompt_info}'
|
RPROMPT='%(?::%F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_rprompt_info}'
|
||||||
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user