# HG changeset patch # User Augie Fackler # Date 1622744817 14400 # Node ID 7e8603e0a8225030a0f87cd10247be6afb27f1b2 # Parent ad9ca178e094029c78d3e0ab8fc98a809680db63 zsh: properly set up zsh async stuff diff --git a/.shell.d/99.prompt.zsh b/.shell.d/99.prompt.zsh --- a/.shell.d/99.prompt.zsh +++ b/.shell.d/99.prompt.zsh @@ -28,10 +28,19 @@ function right_side_prompt() { fi } +function _init_async() { + async + async_stop_worker 'durin42_prompt' || true + async_start_worker durin42_prompt -u -n + async_register_callback durin42_prompt right_prompt_results +} + function right_prompt_results() { if [ $2 = 0 ] ; then rps_branch=$3 zle && zle reset-prompt + else + _init_async fi } @@ -73,10 +82,8 @@ if [[ $TERM == "dumb" ]]; then # in ema PS1='$ ' RPS1='' else - autoload -Uz async && async - async_start_worker durin42_prompt -u -n - async_register_callback durin42_prompt right_prompt_results - + autoload -Uz async + _init_async function precmd () { rps_branch="$(date '+%D %H:%M')" async_job durin42_prompt right_side_prompt $PWD