fdff70006c2cf577e1bf47e87faf7b793b1ec4de

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #4863 from ysmood/optimize-ys-theme

Optimize the ys.zsh-theme make it more expressive

Diff

 1diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme
 2index fd8adc41ea30f26ae9a5179a7796934cc67fbbad..737b506beb4b82d97040d0ba6d5b9b989f4c4987 100644
 3--- a/themes/ys.zsh-theme
 4+++ b/themes/ys.zsh-theme
 5@@ -1,18 +1,9 @@
 6 # Clean, simple, compatible and meaningful.
 7 # Tested on Linux, Unix and Windows under ANSI colors.
 8-# It is recommended to use with a dark background and the font Inconsolata.
 9+# It is recommended to use with a dark background.
10 # Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
11-# 
12-# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/
13-# Mar 2013 ys
14-
15-# Machine name.
16-function box_name {
17-    [ -f ~/.box-name ] && cat ~/.box-name || echo $HOST
18-}
19-
20-# Directory info.
21-local current_dir='${PWD/#$HOME/~}'
22+#
23+# Mar 2013 Yad Smood
24 
25 # VCS
26 YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} "
27@@ -21,7 +12,7 @@ YS_VCS_PROMPT_SUFFIX="%{$reset_color%}"
28 YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x"
29 YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o"
30 
31-# Git info.
32+# Git info
33 local git_info='$(git_prompt_info)'
34 ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}"
35 ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX"
36@@ -44,29 +35,26 @@ ys_hg_prompt_info() {
37 	fi
38 }
39 
40-# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $ 
41-PROMPT="
42-%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
43-%{$fg[cyan]%}%n \
44-%{$fg[white]%}at \
45-%{$fg[green]%}$(box_name) \
46-%{$fg[white]%}in \
47-%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
48-${hg_info}\
49-${git_info} \
50-%{$fg[white]%}[%*]
51-%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
52+local exit_code="%(?,%?,%{$fg[red]%}%?%{$reset_color%})"
53 
54-if [[ "$USER" == "root" ]]; then
55+# Prompt format:
56+#
57+# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] tty:$TTY L:$SHELL_LEVEL N:LINE_NUM C:LAST_EXIT_CODE
58+# $ COMMAND
59+#
60+# For example:
61+#
62+# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] tty:s000 L:1 N:12 C:0
63+# $
64 PROMPT="
65 %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
66-%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \
67-%{$fg[white]%}at \
68-%{$fg[green]%}$(box_name) \
69+%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \
70+%{$fg[white]%}@ \
71+%{$fg[green]%}%m \
72 %{$fg[white]%}in \
73-%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
74+%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
75 ${hg_info}\
76-${git_info} \
77-%{$fg[white]%}[%*]
78+${git_info}\
79+ \
80+%{$fg[white]%}[%*] tty:%l L:%L N:%i C:$exit_code
81 %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
82-fi