1
0
Fork 0

Swithcing remotes

pull/837/head
Milind Shakya 9 years ago
commit 88b500d685

@ -8,6 +8,7 @@
# Isaac Wolkerstorfer <i@agnoster.net> # Isaac Wolkerstorfer <i@agnoster.net>
# Jeff Sandberg <paradox460@gmail.com> # Jeff Sandberg <paradox460@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# Milind Shakya <sh.milind@gmail.com>
# #
# Screenshots: # Screenshots:
# http://i.imgur.com/0XIWX.png # http://i.imgur.com/0XIWX.png
@ -52,103 +53,119 @@ function prompt_paradox_build_prompt {
prompt_paradox_start_segment green black '${(e)git_info[ref]}${(e)git_info[status]}' prompt_paradox_start_segment green black '${(e)git_info[ref]}${(e)git_info[status]}'
fi fi
prompt_paradox_end_segment if [[ -n "${python_info}" ]]; then
} prompt_paradox_start_segment yellow black '${python_info[ref]}${python_info[virtualenv]}'
fi
function prompt_paradox_pwd {
local pwd="${PWD/#$HOME/~}" f [[ -n "${http_proxy}" ]]; then
prompt_paradox_start_segment blue black 'PROXY'
if [[ "$pwd" == (#m)[/~] ]]; then fi
_prompt_paradox_pwd="$MATCH"
unset MATCH prompt_paradox_end_segment
else
_prompt_paradox_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}"
fi unction prompt_paradox_pwd {
} local pwd="${PWD/#$HOME/~}"
function prompt_paradox_print_elapsed_time { if [[ "$pwd" == (#m)[/~] ]]; then
local end_time=$(( SECONDS - _prompt_paradox_start_time )) _prompt_paradox_pwd="$MATCH"
local hours minutes seconds remainder unset MATCH
else
if (( end_time >= 3600 )); then _prompt_paradox_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}"
hours=$(( end_time / 3600 )) fi
remainder=$(( end_time % 3600 ))
minutes=$(( remainder / 60 ))
seconds=$(( remainder % 60 )) unction prompt_paradox_print_elapsed_time {
print -P "%B%F{red}>>> elapsed time ${hours}h${minutes}m${seconds}s%b" local end_time=$(( SECONDS - _prompt_paradox_start_time ))
elif (( end_time >= 60 )); then local hours minutes seconds remainder
minutes=$(( end_time / 60 ))
seconds=$(( end_time % 60 )) if (( end_time >= 3600 )); then
print -P "%B%F{yellow}>>> elapsed time ${minutes}m${seconds}s%b" hours=$(( end_time / 3600 ))
elif (( end_time > 10 )); then remainder=$(( end_time % 3600 ))
print -P "%B%F{green}>>> elapsed time ${end_time}s%b" minutes=$(( remainder / 60 ))
fi seconds=$(( remainder % 60 ))
} print -P "%B%F{red}>>> elapsed time ${hours}h${minutes}m${seconds}s%b"
elif (( end_time >= 60 )); then
function prompt_paradox_precmd { minutes=$(( end_time / 60 ))
setopt LOCAL_OPTIONS seconds=$(( end_time % 60 ))
unsetopt XTRACE KSH_ARRAYS print -P "%B%F{yellow}>>> elapsed time ${minutes}m${seconds}s%b"
elif (( end_time > 10 )); then
# Format PWD. print -P "%B%F{green}>>> elapsed time ${end_time}s%b"
prompt_paradox_pwd fi
# Get Git repository information.
if (( $+functions[git-info] )); then unction prompt_paradox_precmd {
git-info setopt LOCAL_OPTIONS
fi unsetopt XTRACE KSH_ARRAYS
# Calculate and print the elapsed time. # Format PWD.
prompt_paradox_print_elapsed_time prompt_paradox_pwd
}
# Get Git repository information.
function prompt_paradox_preexec { if (( $+functions[git-info] )); then
_prompt_paradox_start_time="$SECONDS" git-info
} fi
function prompt_paradox_setup { # Get Virtual env info
setopt LOCAL_OPTIONS if (( $+functions[python-info] )); then
unsetopt XTRACE KSH_ARRAYS python-info
prompt_opts=(cr percent subst) fi
# Load required functions. # Calculate and print the elapsed time.
autoload -Uz add-zsh-hook prompt_paradox_print_elapsed_time
# Add hook for calling git-info before each command.
add-zsh-hook preexec prompt_paradox_preexec unction prompt_paradox_preexec {
add-zsh-hook precmd prompt_paradox_precmd _prompt_paradox_start_time="$SECONDS"
# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b' unction prompt_paradox_setup {
zstyle ':prezto:module:editor:info:keymap:primary' format '%B%F{blue}%f%b' setopt LOCAL_OPTIONS
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format '%F{red}♺%f' unsetopt XTRACE KSH_ARRAYS
zstyle ':prezto:module:editor:info:keymap:alternate' format '%B%F{red}%f%b' prompt_opts=(cr percent subst)
# Set git-info parameters. # Load required functions.
zstyle ':prezto:module:git:info' verbose 'yes' autoload -Uz add-zsh-hook
zstyle ':prezto:module:git:info:action' format ' ⁝ %s'
zstyle ':prezto:module:git:info:added' format ' ✚' # Add hook for calling git-info before each command.
zstyle ':prezto:module:git:info:ahead' format ' ⬆' add-zsh-hook preexec prompt_paradox_preexec
zstyle ':prezto:module:git:info:behind' format ' ⬇' add-zsh-hook precmd prompt_paradox_precmd
zstyle ':prezto:module:git:info:branch' format ' %b'
zstyle ':prezto:module:git:info:commit' format '➦ %.7c' # Set editor-info parameters.
zstyle ':prezto:module:git:info:deleted' format ' ✖' zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
zstyle ':prezto:module:git:info:dirty' format ' ⁝' zstyle ':prezto:module:editor:info:keymap:primary' format '%B%F{blue}%f%b'
zstyle ':prezto:module:git:info:modified' format ' ✱' zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format '%F{red}♺%f'
zstyle ':prezto:module:git:info:position' format '%p' zstyle ':prezto:module:editor:info:keymap:alternate' format '%B%F{red}%f%b'
zstyle ':prezto:module:git:info:renamed' format ' ➙'
zstyle ':prezto:module:git:info:stashed' format ' S' # Set git-info parameters.
zstyle ':prezto:module:git:info:unmerged' format ' ═' zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:untracked' format ' ?' zstyle ':prezto:module:git:info:action' format ' ⁝ %s'
zstyle ':prezto:module:git:info:keys' format \ zstyle ':prezto:module:git:info:added' format ' ✚'
'ref' '$(coalesce "%b" "%p" "%c")' \ zstyle ':prezto:module:git:info:ahead' format ' ⬆'
'status' '%s%D%A%B%S%a%d%m%r%U%u' zstyle ':prezto:module:git:info:behind' format ' ⬇'
zstyle ':prezto:module:git:info:branch' format ' %b'
# Define prompts. zstyle ':prezto:module:git:info:commit' format '➦ %.7c'
PROMPT=' zstyle ':prezto:module:git:info:deleted' format ' ✖'
${(e)$(prompt_paradox_build_prompt)} zstyle ':prezto:module:git:info:dirty' format ' ⁝'
${editor_info[keymap]} ' zstyle ':prezto:module:git:info:modified' format ' ✱'
RPROMPT='%F{blue}[%F{green}%D{%H:%M:%S}%F{blue}]%f' zstyle ':prezto:module:git:info:position' format '%p'
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' zstyle ':prezto:module:git:info:renamed' format ' ➙'
} zstyle ':prezto:module:git:info:stashed' format ' S'
zstyle ':prezto:module:git:info:unmerged' format ' ═'
prompt_paradox_setup "$@" zstyle ':prezto:module:git:info:untracked' format ' ?'
zstyle ':prezto:module:git:info:keys' format \
'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)}
${editor_info[keymap]} '
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]? '
}
prompt_paradox_setup "$@"

Loading…
Cancel
Save