浏览代码

add: exit code

Yad Smood 8 年之前
父节点
当前提交
9a2376bd29
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      themes/ys.zsh-theme

+ 6 - 4
themes/ys.zsh-theme

@@ -35,15 +35,16 @@ ys_hg_prompt_info() {
 	fi
 }
 
+local exit_code="%(?,%?,%{$fg[red]%}%?%{$reset_color%})"
 
 # Prompt format:
 #
-# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] L:SHELL_LEVEL N:LINE_NUM
+# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] tty:$TTY L:$SHELL_LEVEL N:LINE_NUM C:LAST_EXIT_CODE
 # $ COMMAND
 #
 # For example:
 #
-# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] tty:s000 L:1 N:12
+# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] tty:s000 L:1 N:12 C:0
 # $
 PROMPT="
 %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
@@ -53,6 +54,7 @@ PROMPT="
 %{$fg[white]%}in \
 %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
 ${hg_info}\
-${git_info} \
-%{$fg[white]%}[%*] tty:%l L:%L N:%i
+${git_info}\
+ \
+%{$fg[white]%}[%*] tty:%l L:%L N:%i C:$exit_code
 %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"