Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to use colors in oh-my-zsh themes. It works fine on my home computer (ubuntu), but in a work computer (Scientific Linux i.e. Enterprise linux) the prompt colors are actually spelled out. For example, my prompt using the blinks theme looks like this (note this ISN'T the code, this is what appears as my prompt, except for my username and computername which I've replaced).

{black}{green}USRENAME{blue}@{cyan}COMPUTERNAME{green}
{yellow}{black}~{green} {black}{blue}±{black} %                       
!{cyan}1128

To see what the blinks prompt should look like, you can look at the oh-my-zsh themes page. (I can't attach images yet with my current reputation).

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Most likely the version of zsh you are using is from before the %F color escape sequence was added. This means that, in addition to not coloring the prompt correctly, it will leave the arguments to this sequence lying around. To solve this you should replace the current theme file with this:

function _prompt_char() {
  if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
    echo "±%{%b%}"
  else
    echo ' '
  fi
}

ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%b%B%}]"
ZSH_THEME_GIT_PROMPT_DIRTY=" *%{%b%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""

PROMPT='%{%b%}
%{%B%}%n%{%B%}@%{%B%}%m%{%B%} %{%b%}%~%{%B%}$(git_prompt_info)%E%{%b%}
%{%}$(_prompt_char)%{%} %#%{%b%} '

RPROMPT='!%{%B%}%!%{%b%}'
share|improve this answer
    
This works, thanks! However, the prompt is still (essentially) monochrome. Different shades of blue/gray. Is there a way to get the nice contrasting yellow colors in the original Blinks theme? –  Caleb Aug 11 '12 at 14:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.