Created
December 24, 2013 01:28
-
-
Save ghawkgu/8107499 to your computer and use it in GitHub Desktop.
A simple 2-line theme for oh-my-zsh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _update_ruby_version() | |
{ | |
typeset -g ruby_version='' | |
if which rvm-prompt &> /dev/null; then | |
ruby_version="$(rvm-prompt i v g)" | |
rvm-prompt i v g | |
else | |
if which rbenv &> /dev/null; then | |
ruby_version="$(rbenv version | sed -e "s/ (set.*$//")" | |
fi | |
fi | |
} | |
chpwd_functions+=(_update_ruby_version) | |
_update_ruby_version | |
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}●" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
function prompt_char { | |
if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi | |
} | |
PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%} | |
) | |
%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) %{$fg_bold[red]%}(Ruby: $ruby_version)%{$reset_color%} | |
%_$(prompt_char) ' | |
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, i'm trying to understand the following piece of code:
PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%})
Here i understand the part:
%{$fg[red]%}
making the text red and$?
for providing the return code. And after that the reset of the color.that taken out it would leave:
PROMPT='%(?, ,FAIL: $?)
Could you explain what this part means?
Thanks in advance.
[Answer found]
Always good to find your own answer. Finding this part: "%(x.true-text.false-text)".
thanks anyway for providing a nice theme. 👍