aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-12-09 16:15:57 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-12-09 16:15:57 +0300
commit14fc4d838c54198faca868c2b91b4e5c1f2c0295 (patch)
treef4b84d64c9c4795260bbaba84c986aa7ed32a823
parent90238d8df8d0b1e436b7d06add965ea87bfad2f3 (diff)
unbreak Git commit formatting
-rw-r--r--config/p10k-classic.zsh9
-rw-r--r--config/p10k-lean.zsh9
-rw-r--r--config/p10k-rainbow.zsh9
3 files changed, 15 insertions, 12 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh
index 832ac3ba..0d740d16 100644
--- a/config/p10k-classic.zsh
+++ b/config/p10k-classic.zsh
@@ -370,16 +370,13 @@
fi
local res
- local where # branch name, tag or commit
+ local where # branch or tag
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#"
where=${(V)VCS_STATUS_TAG}
- else
- res+="${meta}@"
- where=${VCS_STATUS_COMMIT[1,8]}
fi
# If local branch name or tag is at most 32 characters long, show it in full.
@@ -387,6 +384,10 @@
(( $#where > 32 )) && where[13,-13]="…"
res+="${clean}${where//\%/%%}" # escape %
+ # Display the current Git commit if there is no branch or tag.
+ # Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
+ [[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
+
# Show tracking branch name if it differs from local branch.
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh
index d58cefe2..bc5da31f 100644
--- a/config/p10k-lean.zsh
+++ b/config/p10k-lean.zsh
@@ -363,16 +363,13 @@
fi
local res
- local where # branch name, tag or commit
+ local where # branch or tag
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#"
where=${(V)VCS_STATUS_TAG}
- else
- res+="${meta}@"
- where=${VCS_STATUS_COMMIT[1,8]}
fi
# If local branch name or tag is at most 32 characters long, show it in full.
@@ -380,6 +377,10 @@
(( $#where > 32 )) && where[13,-13]="…"
res+="${clean}${where//\%/%%}" # escape %
+ # Display the current Git commit if there is no branch or tag.
+ # Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
+ [[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
+
# Show tracking branch name if it differs from local branch.
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %
diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh
index 991afcfc..a302a9e9 100644
--- a/config/p10k-rainbow.zsh
+++ b/config/p10k-rainbow.zsh
@@ -369,16 +369,13 @@
local conflicted='%1F' # red foreground
local res
- local where # branch name, tag or commit
+ local where # branch or tag
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#"
where=${(V)VCS_STATUS_TAG}
- else
- res+="${meta}@"
- where=${VCS_STATUS_COMMIT[1,8]}
fi
# If local branch name or tag is at most 32 characters long, show it in full.
@@ -386,6 +383,10 @@
(( $#where > 32 )) && where[13,-13]="…"
res+="${clean}${where//\%/%%}" # escape %
+ # Display the current Git commit if there is no branch or tag.
+ # Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
+ [[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
+
# Show tracking branch name if it differs from local branch.
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %