fix shell integration with kitty

This commit is contained in:
Roman Perepelitsa 2022-02-01 20:39:00 +01:00
parent 4f143b7b97
commit 8a676a9157
1 changed files with 26 additions and 0 deletions

View File

@ -5637,6 +5637,7 @@ _p9k_preexec2() {
typeset -g _p9k__preexec_cmd=$2
_p9k__timer_start=EPOCHREALTIME
P9K_TTY=old
(( ! $+_p9k__iterm_cmd )) || _p9k_iterm2_preexec
}
function _p9k_prompt_net_iface_init() {
@ -6873,6 +6874,10 @@ _p9k_precmd_impl() {
_p9k__zle_state=insert
(( ++_p9k__prompt_idx ))
if (( $+_p9k__iterm_cmd )); then
_p9k_iterm2_precmd $__p9k_new_status
fi
fi
_p9k_fetch_cwd
@ -8600,6 +8605,20 @@ _p9k_init_vcs() {
(( $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )) || _p9k__instant_prompt_disabled=1
}
function _p9k_iterm2_precmd() {
builtin zle && return
if (( _p9k__iterm_cmd )) && [[ -t 1 ]]; then
(( _p9k__iterm_cmd == 1 )) && builtin print -n '\e]133;C;\a'
builtin printf '\e]133;D;%s\a' $1
fi
typeset -gi _p9k__iterm_cmd=1
}
function _p9k_iterm2_preexec() {
[[ -t 1 ]] && builtin print -n '\e]133;C;\a'
typeset -gi _p9k__iterm_cmd=2
}
_p9k_init() {
_p9k_init_vars
_p9k_restore_state || _p9k_init_cacheable
@ -8663,6 +8682,13 @@ _p9k_init() {
functions[iterm2_precmd]='local _p9k_status=$?; zle && return; () { return $_p9k_status; }; '$_p9k__iterm2_precmd
fi
if (( _POWERLEVEL9K_TERM_SHELL_INTEGRATION &&
! $+_z4h_iterm_cmd &&
! $+functions[iterm2_decorate_prompt] &&
! $+functions[iterm2_precmd] )); then
typeset -gi _p9k__iterm_cmd=0
fi
if _p9k_segment_in_use todo; then
if [[ -n ${_p9k__todo_command::=${commands[todo.sh]}} ]]; then
local todo_global=/etc/todo/config