|
|
|
@ -32,7 +32,9 @@
|
|
|
|
|
# Load dependencies.
|
|
|
|
|
pmodload 'helper'
|
|
|
|
|
|
|
|
|
|
function prompt_sorin_git_info {
|
|
|
|
|
function prompt_sorin_async_callback {
|
|
|
|
|
case $1 in
|
|
|
|
|
prompt_sorin_async_git)
|
|
|
|
|
# We can safely split on ':' because it isn't allowed in ref names.
|
|
|
|
|
IFS=':' read _git_target _git_post_target <<<"$3"
|
|
|
|
|
|
|
|
|
@ -51,6 +53,8 @@ function prompt_sorin_git_info {
|
|
|
|
|
_prompt_sorin_git="${_git_target}${_git_post_target}"
|
|
|
|
|
zle && zle reset-prompt
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_sorin_async_git {
|
|
|
|
@ -61,6 +65,22 @@ function prompt_sorin_async_git {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_sorin_async_tasks {
|
|
|
|
|
# Initialize async worker. This needs to be done here and not in
|
|
|
|
|
# prompt_sorin_setup so the git formatting can be overridden by other prompts.
|
|
|
|
|
if (( !${prompt_prezto_async_init:-0} )); then
|
|
|
|
|
async_start_worker prompt_sorin -n
|
|
|
|
|
async_register_callback prompt_sorin prompt_sorin_async_callback
|
|
|
|
|
typeset -g prompt_prezto_async_init=1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Kill the old process of slow commands if it is still running.
|
|
|
|
|
async_flush_jobs async_sorin_git
|
|
|
|
|
|
|
|
|
|
# Compute slow commands in the background.
|
|
|
|
|
async_job async_sorin_git prompt_sorin_async_git "$PWD"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_sorin_precmd {
|
|
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
@ -68,9 +88,6 @@ function prompt_sorin_precmd {
|
|
|
|
|
# Format PWD.
|
|
|
|
|
_prompt_sorin_pwd=$(prompt-pwd)
|
|
|
|
|
|
|
|
|
|
# Kill the old process of slow commands if it is still running.
|
|
|
|
|
async_flush_jobs async_sorin_git
|
|
|
|
|
|
|
|
|
|
# Handle updating git data. We also clear the git prompt data if we're in a
|
|
|
|
|
# different git root now.
|
|
|
|
|
if (( $+functions[git-dir] )); then
|
|
|
|
@ -81,14 +98,12 @@ function prompt_sorin_precmd {
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Run python info (this should be fast and not require any async)
|
|
|
|
|
if (( $+functions[python-info] )); then
|
|
|
|
|
python-info
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Compute slow commands in the background.
|
|
|
|
|
async_job async_sorin_git prompt_sorin_async_git "$PWD"
|
|
|
|
|
prompt_sorin_async_tasks
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prompt_sorin_setup {
|
|
|
|
@ -139,8 +154,6 @@ function prompt_sorin_setup {
|
|
|
|
|
zstyle ':prezto:module:python:info:virtualenv' format '%f%F{3}(%v)%F{7} '
|
|
|
|
|
|
|
|
|
|
# Get the async worker set up
|
|
|
|
|
async_start_worker async_sorin_git -n
|
|
|
|
|
async_register_callback async_sorin_git prompt_sorin_git_info
|
|
|
|
|
_sorin_cur_git_root=''
|
|
|
|
|
|
|
|
|
|
_prompt_sorin_git=''
|
|
|
|
|