]> git.alrj.org Git - zsh.d.git/commitdiff
Show exit code as signal name, if terminated by a signal.
authorAmand Tihon <amand.tihon@iba-group.com>
Tue, 9 Jun 2009 16:09:43 +0000 (18:09 +0200)
committerAmand Tihon <amand.tihon@iba-group.com>
Tue, 9 Jun 2009 16:09:43 +0000 (18:09 +0200)
S10_zshopts
S22_exitcode [new file with mode: 0644]
S60_git
S90_prompt

index d90bec049111d33265bf5a4ba2a4c6da1625eb06..4f3c2f8486271c96627588cf64462b6b52ca3cb0 100644 (file)
@@ -11,6 +11,8 @@ setopt nobeep
 typeset -ga preexec_functions
 typeset -ga precmd_functions
 typeset -ga chpwd_functions
+psvar=()
+
 
 [ -w $zsh_cache ] && HISTFILE=$zsh_cache/history
 
diff --git a/S22_exitcode b/S22_exitcode
new file mode 100644 (file)
index 0000000..9888b34
--- /dev/null
@@ -0,0 +1,14 @@
+#! /usr/bin/zsh
+
+
+parse_exitcode() {
+  EX=`print -P %?`
+  psvar[1]=$EX
+
+  if [[ $EX -ge 128 ]]
+  then
+    psvar[1]="${signals[${EX}-127]}"
+  fi
+}
+
+precmd_functions+='parse_exitcode'
diff --git a/S60_git b/S60_git
index 9eb816b48017acdf0dff2d600b32d10540cd1e3e..8926a73476a209f1a479ad1b13b882333e05cb13 100644 (file)
--- a/S60_git
+++ b/S60_git
@@ -8,7 +8,6 @@ export __ZSH_GIT_VARS_INVALID=1
 
 git_parse() {
 
-    psvar=()
     local git_dir ref base_dir sub_dir action branch
 
     git_dir=$(git rev-parse --git-dir 2> /dev/null) || return
index 2fe519a29479787bbc7f1adb21b96833a398e742..a9d379a11fc857ef92bbafeae72d9f56fab2098e 100644 (file)
@@ -23,7 +23,7 @@ _username="${C_BYELLOW}%n${C_NO}"
 _machine="${C_BRED}%m${C_NO}"
 _hour="${C_BCYAN}[%D{%H:%M}]${C_NO}"
 
-_exitcode="%(?::${C_BRED}[ %? ]${C_NO}
+_exitcode="%(?::${C_BRED}[ %1v ]${C_NO}
 )$(true)"
 
 _action="%(3v,%3v%,)"