1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 21:58:00 +00:00

[Fix #41] Do not truncate the commit id

This commit is contained in:
Colin Hebert 2012-03-15 00:19:49 +00:00 committed by Sorin Ionescu
parent 514aaa014b
commit cdb95f810f
3 changed files with 12 additions and 8 deletions

View File

@ -15,6 +15,15 @@ function is-true() {
[[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]]
}
# Prints the first non-empty string in the arguments array.
function coalesce() {
for arg in "$argv[@]"; do
print "$arg"
return 0
done
return 1
}
# Trap signals were generated with 'kill -l'.
# DEBUG, EXIT, and ZERR are Zsh signals.
TRAP_SIGNALS=(

View File

@ -140,7 +140,6 @@ function git-info() {
local clean
local clean_formatted
local commit
local commit_short
local commit_format
local deleted=0
local deleted_format
@ -220,9 +219,8 @@ function git-info() {
commit="$(git rev-parse HEAD 2>/dev/null)"
# Format commit (short).
commit_short="$commit[1,7]"
zstyle -s ':omz:plugin:git:prompt' commit 'commit_format'
zformat -f commit_formatted "$commit_format" "c:$commit_short"
zformat -f commit_formatted "$commit_format" "c:$commit"
# Stashed
if [[ -f "$(_git-dir)/refs/stash" ]]; then
@ -238,9 +236,6 @@ function git-info() {
(( line_number++ ))
if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then
# Set branch to commit (short) when the branch is not found.
branch="$commit_short"
# Get action.
action="$(_git-action)"
if [[ -n "$action" ]]; then

View File

@ -35,12 +35,12 @@ function prompt_sorin_setup() {
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' renamed ' %%B%F{magenta}➜%f%%b'
zstyle ':omz:plugin:git:prompt' commit '%c'
zstyle ':omz:plugin:git:prompt' commit '%.7c'
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' untracked ' %%B%F{white}◼%f%%b'
zstyle ':omz:plugin:git:prompt' prompt ' %F{blue}git%f%b%s'
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) '
RPROMPT='%(?::%F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_rprompt_info}'