diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2020-01-20 22:12:14 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2020-01-20 22:12:14 +0300 |
commit | 80e8e46fe59c1325c501d42757ff9d2ee40abcd6 (patch) | |
tree | f12d033ea43f9cde3429b9e2cb02cccc983815e5 /internal/p10k.zsh | |
parent | e01b5d9529de31899ad5ee4d90a02704ca7dcef4 (diff) | |
parent | 9586e24dfb71752afa04db77ad7e79c7430b883b (diff) |
Merge branch 'master' into worker
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r-- | internal/p10k.zsh | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index a3b4bb1f..9eb9cc67 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -3960,7 +3960,9 @@ function instant_prompt_direnv() { fi } -_p9k_preexec() { +# Use two preexec hooks to survive https://github.com/MichaelAquilina/zsh-you-should-use with +# YSU_HARDCORE=1. See https://github.com/romkatv/powerlevel10k/issues/427. +_p9k_preexec1() { if (( $+_p9k_real_zle_rprompt_indent )); then if [[ -n $_p9k_real_zle_rprompt_indent ]]; then ZLE_RPROMPT_INDENT=$_p9k_real_zle_rprompt_indent @@ -3969,6 +3971,10 @@ _p9k_preexec() { fi unset _p9k_real_zle_rprompt_indent fi + (( $+functions[TRAPINT] )) || trap - INT +} + +_p9k_preexec2() { _p9k__preexec_cmd=$2 _p9k__timer_start=EPOCHREALTIME } @@ -4896,8 +4902,7 @@ _p9k_precmd_impl() { _p9k__timer_start=0 _p9k__region_active=0 - unset _p9k__line_finished - unset _p9k__preexec_cmd + unset _p9k__line_finished _p9k__preexec_cmd _p9k__keymap=main _p9k__zle_state=insert @@ -4911,11 +4916,17 @@ _p9k_precmd_impl() { _p9k_set_prompt _p9k_refresh_reason='' + if [[ $precmd_functions[1] != _p9k_do_nothing && $precmd_functions[(I)_p9k_do_nothing] != 0 ]]; then + precmd_functions=(_p9k_do_nothing ${(@)precmd_functions:#_p9k_do_nothing}) + fi if [[ $precmd_functions[-1] != _p9k_precmd && $precmd_functions[(I)_p9k_precmd] != 0 ]]; then precmd_functions=(${(@)precmd_functions:#_p9k_precmd} _p9k_precmd) fi - if [[ $precmd_functions[1] != _p9k_do_nothing && $precmd_functions[(I)_p9k_do_nothing] != 0 ]]; then - precmd_functions=(_p9k_do_nothing ${(@)precmd_functions:#_p9k_do_nothing}) + if [[ $preexec_functions[1] != _p9k_preexec1 && $preexec_functions[(I)_p9k_preexec1] != 0 ]]; then + preexec_functions=(_p9k_preexec1 ${(@)preexec_functions:#_p9k_preexec1}) + fi + if [[ $preexec_functions[-1] != _p9k_preexec2 && $preexec_functions[(I)_p9k_preexec2] != 0 ]]; then + preexec_functions=(${(@)preexec_functions:#_p9k_preexec2} _p9k_preexec2) fi } @@ -6738,7 +6749,7 @@ prompt_powerlevel9k_setup() { setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases prompt_powerlevel9k_teardown __p9k_enabled=1 - add-zsh-hook preexec _p9k_preexec + typeset -ga preexec_functions=(_p9k_preexec1 $preexec_functions _p9k_preexec2) typeset -ga precmd_functions=(_p9k_do_nothing $precmd_functions _p9k_precmd) } |