From c537dae629b3d29e7c63a75a998862ee1f2114c7 Mon Sep 17 00:00:00 2001 From: Suvash Thapaliya Date: Thu, 27 Sep 2012 00:56:11 +0200 Subject: [PATCH] Revised suvash theme - minimal prompt - pythonbrew/venv support - smart right prompt --- themes/suvash.zsh-theme | 59 +++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/themes/suvash.zsh-theme b/themes/suvash.zsh-theme index c87f64558..a985b4268 100644 --- a/themes/suvash.zsh-theme +++ b/themes/suvash.zsh-theme @@ -4,27 +4,58 @@ function prompt_char { echo '○' } -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' -} - function collapse_pwd { echo $(pwd | sed -e "s,^$HOME,~,") } +function prompt_rvm_ruby { if which rvm-prompt &> /dev/null; then - PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} -$(virtualenv_info)$(prompt_char) ' -else - if which rbenv &> /dev/null; then - PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} -$(virtualenv_info)$(prompt_char) ' + echo $(rvm-prompt i v g) +fi +} + +function prompt_python_version { +if which python &> /dev/null; then + echo 'python-'`python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))'` +fi +} + +function prompt_pythonbrew_python { +if which pythonbrew &> /dev/null; then + if [ $VIRTUAL_ENV ]; then + echo $(prompt_python_version)'#'`basename $VIRTUAL_ENV` + else + echo $(prompt_python_version) fi fi +} +function prompt_right_dynamic_length { +if [ "${COLUMNS}" -gt "160" ]; then + echo "%{$fg[red]%}$(prompt_rvm_ruby)%{$reset_color%} ‹ %{$fg[red]%}$(prompt_pythonbrew_python)%{$reset_color%}" +elif [ "${COLUMNS}" -gt "80" ]; then + echo "%{$fg[red]%}$(prompt_rvm_ruby)%{$reset_color%}" +else + echo "" +fi +} -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" +ZSH_THEME_GIT_PROMPT_PREFIX=" › %{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_UNTRACKED="" ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}⚐%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}⚈%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚆%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%}⚒%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}⚛%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%}☢%{$reset_color%}" + + +PROMPT='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[blue]%}@%{$reset_color%}%{$fg[magenta]%}%m%{$reset_color%} › %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info)$(git_prompt_status)%{$reset_color%} +$(prompt_char) ' + +RPROMPT='$(prompt_right_dynamic_length)' +