1
0
Fork 0

Update prompt_paradox_setup

pull/837/head^2
Milind Shakya 9 years ago
parent b5eedbf3ba
commit 142730e562

@ -57,10 +57,14 @@ function prompt_paradox_build_prompt {
prompt_paradox_start_segment yellow black '${python_info[ref]}${python_info[virtualenv]}' prompt_paradox_start_segment yellow black '${python_info[ref]}${python_info[virtualenv]}'
fi fi
f [[ -n "${http_proxy}" ]]; then
prompt_paradox_start_segment blue black 'PROXY'
fi
prompt_paradox_end_segment prompt_paradox_end_segment
}
function prompt_paradox_pwd {
unction prompt_paradox_pwd {
local pwd="${PWD/#$HOME/~}" local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then if [[ "$pwd" == (#m)[/~] ]]; then
@ -69,9 +73,9 @@ function prompt_paradox_pwd {
else else
_prompt_paradox_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}" _prompt_paradox_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}"
fi fi
}
function prompt_paradox_print_elapsed_time {
unction prompt_paradox_print_elapsed_time {
local end_time=$(( SECONDS - _prompt_paradox_start_time )) local end_time=$(( SECONDS - _prompt_paradox_start_time ))
local hours minutes seconds remainder local hours minutes seconds remainder
@ -88,9 +92,9 @@ function prompt_paradox_print_elapsed_time {
elif (( end_time > 10 )); then elif (( end_time > 10 )); then
print -P "%B%F{green}>>> elapsed time ${end_time}s%b" print -P "%B%F{green}>>> elapsed time ${end_time}s%b"
fi fi
}
function prompt_paradox_precmd {
unction prompt_paradox_precmd {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
@ -109,13 +113,13 @@ function prompt_paradox_precmd {
# Calculate and print the elapsed time. # Calculate and print the elapsed time.
prompt_paradox_print_elapsed_time prompt_paradox_print_elapsed_time
}
function prompt_paradox_preexec {
unction prompt_paradox_preexec {
_prompt_paradox_start_time="$SECONDS" _prompt_paradox_start_time="$SECONDS"
}
function prompt_paradox_setup {
unction prompt_paradox_setup {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst) prompt_opts=(cr percent subst)
@ -158,10 +162,10 @@ function prompt_paradox_setup {
# Define prompts. # Define prompts.
PROMPT=' PROMPT='
${(e)$(prompt_paradox_build_prompt)} ${(e)$(prompt_paradox_build_prompt)}
${editor_info[keymap]} ' ${editor_info[keymap]} '
RPROMPT='%F{blue}[%F{green}%D{%H:%M:%S}%F{blue}]%f' RPROMPT='%F{blue}[%F{green}%D{%H:%M:%S}%F{blue}]%f'
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
} }
prompt_paradox_setup "$@" prompt_paradox_setup "$@"

Loading…
Cancel
Save