|
|
|
@ -8,6 +8,7 @@
|
|
|
|
|
# Isaac Wolkerstorfer <i@agnoster.net>
|
|
|
|
|
# Jeff Sandberg <paradox460@gmail.com>
|
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
|
# Milind Shakya <sh.milind@gmail.com>
|
|
|
|
|
#
|
|
|
|
|
# Screenshots:
|
|
|
|
|
# http://i.imgur.com/0XIWX.png
|
|
|
|
@ -52,10 +53,18 @@ function prompt_paradox_build_prompt {
|
|
|
|
|
prompt_paradox_start_segment green black '${(e)git_info[ref]}${(e)git_info[status]}'
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ -n "${python_info}" ]]; then
|
|
|
|
|
prompt_paradox_start_segment yellow black '${python_info[ref]}${python_info[virtualenv]}'
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
f [[ -n "${http_proxy}" ]]; then
|
|
|
|
|
prompt_paradox_start_segment blue black 'PROXY'
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
prompt_paradox_end_segment
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_paradox_pwd {
|
|
|
|
|
|
|
|
|
|
unction prompt_paradox_pwd {
|
|
|
|
|
local pwd="${PWD/#$HOME/~}"
|
|
|
|
|
|
|
|
|
|
if [[ "$pwd" == (#m)[/~] ]]; then
|
|
|
|
@ -64,9 +73,9 @@ function prompt_paradox_pwd {
|
|
|
|
|
else
|
|
|
|
|
_prompt_paradox_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_paradox_print_elapsed_time {
|
|
|
|
|
|
|
|
|
|
unction prompt_paradox_print_elapsed_time {
|
|
|
|
|
local end_time=$(( SECONDS - _prompt_paradox_start_time ))
|
|
|
|
|
local hours minutes seconds remainder
|
|
|
|
|
|
|
|
|
@ -83,9 +92,9 @@ function prompt_paradox_print_elapsed_time {
|
|
|
|
|
elif (( end_time > 10 )); then
|
|
|
|
|
print -P "%B%F{green}>>> elapsed time ${end_time}s%b"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_paradox_precmd {
|
|
|
|
|
|
|
|
|
|
unction prompt_paradox_precmd {
|
|
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
|
|
|
|
|
@ -97,15 +106,20 @@ function prompt_paradox_precmd {
|
|
|
|
|
git-info
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Get Virtual env info
|
|
|
|
|
if (( $+functions[python-info] )); then
|
|
|
|
|
python-info
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Calculate and print the elapsed time.
|
|
|
|
|
prompt_paradox_print_elapsed_time
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_paradox_preexec {
|
|
|
|
|
|
|
|
|
|
unction prompt_paradox_preexec {
|
|
|
|
|
_prompt_paradox_start_time="$SECONDS"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_paradox_setup {
|
|
|
|
|
|
|
|
|
|
unction prompt_paradox_setup {
|
|
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
|
prompt_opts=(cr percent subst)
|
|
|
|
@ -143,6 +157,9 @@ function prompt_paradox_setup {
|
|
|
|
|
'ref' '$(coalesce "%b" "%p" "%c")' \
|
|
|
|
|
'status' '%s%D%A%B%S%a%d%m%r%U%u'
|
|
|
|
|
|
|
|
|
|
# Set python-info parameters.
|
|
|
|
|
zstyle ':prezto:module:python:info:virtualenv' format '%F{black}py:%v%f'
|
|
|
|
|
|
|
|
|
|
# Define prompts.
|
|
|
|
|
PROMPT='
|
|
|
|
|
${(e)$(prompt_paradox_build_prompt)}
|
|
|
|
|