~kiril/dotfiles

ref: d0c0f47e040f362c4c85c7042a64a34d13a020f8 dotfiles/zsh/funcs -rw-r--r-- 699 bytes
d0c0f47eKiril Vladimiroff systemd: replace offlineimap with mbsync 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/zsh

source $DOTFILES/sh/funcs

function virtualenv_prompt_info() {
    if [ -n "$VIRTUAL_ENV" ]; then
        if [ -f "$VIRTUAL_ENV/__name__" ]; then
            local name=`cat $VIRTUAL_ENV/__name__`
        elif [ `basename $VIRTUAL_ENV` = "__" ]; then
            local name=$(basename $(dirname $VIRTUAL_ENV))
        else
            local name=$(basename $VIRTUAL_ENV)
        fi
        echo "($name)"
    fi
}

function exit_code_prompt() {
  local LAST_EXIT_CODE=$?
  if [[ $LAST_EXIT_CODE -eq 0 ]]; then
    EXIT_CODE_PROMPT="%{$fg_bold[green]%}-->%{$reset_color%}"
  else
    EXIT_CODE_PROMPT="%{$fg_bold[red]%}$LAST_EXIT_CODE->%{$reset_color%}"
  fi
  echo "$EXIT_CODE_PROMPT"
}