aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-09-12 12:35:24 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-09-12 12:35:24 +0300
commit9c9039253c2da76e553c1cd2f4e822142bf708a9 (patch)
tree8de1c9942a4ea4cf6b50e9e79b5bc06cddecfe0e /internal/p10k.zsh
parent3674e69b4329fba47945e0fd2beb065ea4cd1cd9 (diff)
put most of precmd code under !zle
Diffstat (limited to 'internal/p10k.zsh')
-rwxr-xr-xinternal/p10k.zsh71
1 files changed, 37 insertions, 34 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 6a080586..c60619f2 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -3244,33 +3244,49 @@ _p9k_precmd() {
__p9k_new_status=$?
__p9k_new_pipestatus=($pipestatus)
- if (( $+_p9k_real_zle_rprompt_indent )); then
- if [[ -n $_p9k_real_zle_rprompt_indent ]]; then
- ZLE_RPROMPT_INDENT=$_p9k_real_zle_rprompt_indent
- else
- unset ZLE_RPROMPT_INDENT
+ if ! zle; then
+ if (( $+_p9k_real_zle_rprompt_indent )); then
+ if [[ -n $_p9k_real_zle_rprompt_indent ]]; then
+ ZLE_RPROMPT_INDENT=$_p9k_real_zle_rprompt_indent
+ else
+ unset ZLE_RPROMPT_INDENT
+ fi
+ unset _p9k_real_zle_rprompt_indent
fi
- unset _p9k_real_zle_rprompt_indent
- fi
- if _p9k_must_init; then
- if (( !__p9k_configured )); then
- __p9k_configured=1
- if [[ "${parameters[(I)POWERLEVEL9K_*]}" == (POWERLEVEL9K_MODE|) ]] && _p9k_can_configure -q; then
- (
- local p=("${(@)parameters[(I)AWESOME_*|CODEPOINT_*]}")
- if (( $#p )); then
- typeset -x -- $p
+ if _p9k_must_init; then
+ if (( !__p9k_configured )); then
+ __p9k_configured=1
+ if [[ "${parameters[(I)POWERLEVEL9K_*]}" == (POWERLEVEL9K_MODE|) ]] && _p9k_can_configure -q; then
+ (
+ local p=("${(@)parameters[(I)AWESOME_*|CODEPOINT_*]}")
+ if (( $#p )); then
+ typeset -x -- $p
+ fi
+ $__p9k_root_dir/internal/wizard.zsh -d $__p9k_root_dir
+ )
+ if (( !$? )); then
+ source $__p9k_cfg_path
+ _p9k_must_init
fi
- $__p9k_root_dir/internal/wizard.zsh -d $__p9k_root_dir
- )
- if (( !$? )); then
- source $__p9k_cfg_path
- _p9k_must_init
fi
fi
+ _p9k_init
fi
- _p9k_init
+
+ _p9k_timer_end=EPOCHREALTIME
+ if (( _p9k_timer_start )); then
+ typeset -gF P9K_COMMAND_DURATION_SECONDS=$((_p9k_timer_end - _p9k_timer_start))
+ else
+ unset P9K_COMMAND_DURATION_SECONDS
+ fi
+ _p9k_save_status
+
+ _p9k_timer_start=0
+ _p9k_region_active=0
+
+ unset _p9k_line_finished
+ unset _p9k_preexec_cmd
fi
unsetopt localoptions
@@ -3279,20 +3295,7 @@ _p9k_precmd() {
[[ ! -o prompt_cr ]] || prompt_opts+=cr
setopt nopromptbang prompt{percent,subst}
- _p9k_timer_end=EPOCHREALTIME
- if (( _p9k_timer_start )); then
- typeset -gF P9K_COMMAND_DURATION_SECONDS=$((_p9k_timer_end - _p9k_timer_start))
- else
- unset P9K_COMMAND_DURATION_SECONDS
- fi
- _p9k_save_status
-
powerlevel9k_refresh_prompt_inplace
-
- unset _p9k_line_finished
- unset _p9k_preexec_cmd
- _p9k_timer_start=0
- _p9k_region_active=0
}
function _p9k_zle_keymap_select() {