Skip to content

Commit 8a676a9

Browse files
committed
fix shell integration with kitty
1 parent 4f143b7 commit 8a676a9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

internal/p10k.zsh

+26
Original file line numberDiff line numberDiff line change
@@ -5637,6 +5637,7 @@ _p9k_preexec2() {
56375637
typeset -g _p9k__preexec_cmd=$2
56385638
_p9k__timer_start=EPOCHREALTIME
56395639
P9K_TTY=old
5640+
(( ! $+_p9k__iterm_cmd )) || _p9k_iterm2_preexec
56405641
}
56415642

56425643
function _p9k_prompt_net_iface_init() {
@@ -6873,6 +6874,10 @@ _p9k_precmd_impl() {
68736874
_p9k__zle_state=insert
68746875

68756876
(( ++_p9k__prompt_idx ))
6877+
6878+
if (( $+_p9k__iterm_cmd )); then
6879+
_p9k_iterm2_precmd $__p9k_new_status
6880+
fi
68766881
fi
68776882

68786883
_p9k_fetch_cwd
@@ -8600,6 +8605,20 @@ _p9k_init_vcs() {
86008605
(( $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )) || _p9k__instant_prompt_disabled=1
86018606
}
86028607

8608+
function _p9k_iterm2_precmd() {
8609+
builtin zle && return
8610+
if (( _p9k__iterm_cmd )) && [[ -t 1 ]]; then
8611+
(( _p9k__iterm_cmd == 1 )) && builtin print -n '\e]133;C;\a'
8612+
builtin printf '\e]133;D;%s\a' $1
8613+
fi
8614+
typeset -gi _p9k__iterm_cmd=1
8615+
}
8616+
8617+
function _p9k_iterm2_preexec() {
8618+
[[ -t 1 ]] && builtin print -n '\e]133;C;\a'
8619+
typeset -gi _p9k__iterm_cmd=2
8620+
}
8621+
86038622
_p9k_init() {
86048623
_p9k_init_vars
86058624
_p9k_restore_state || _p9k_init_cacheable
@@ -8663,6 +8682,13 @@ _p9k_init() {
86638682
functions[iterm2_precmd]='local _p9k_status=$?; zle && return; () { return $_p9k_status; }; '$_p9k__iterm2_precmd
86648683
fi
86658684

8685+
if (( _POWERLEVEL9K_TERM_SHELL_INTEGRATION &&
8686+
! $+_z4h_iterm_cmd &&
8687+
! $+functions[iterm2_decorate_prompt] &&
8688+
! $+functions[iterm2_precmd] )); then
8689+
typeset -gi _p9k__iterm_cmd=0
8690+
fi
8691+
86668692
if _p9k_segment_in_use todo; then
86678693
if [[ -n ${_p9k__todo_command::=${commands[todo.sh]}} ]]; then
86688694
local todo_global=/etc/todo/config

0 commit comments

Comments
 (0)