Skip to content

Commit

Permalink
Merge branch 'fix-zsh-ssh-integration' of https://github.com/3j14/kitty
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jan 5, 2025
2 parents 6fbeb93 + bfbf22e commit 39629db
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions shell-integration/zsh/kitty-integration
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,15 @@ _ksi_deferred_init() {

if [[ "$is_ssh_session" == "y" ]]; then
# show the hostname via %m for SSH sessions
builtin local hostname="$(builtin print -Pn "%m")"
# The variable `hostname` is used such that we don't have to use
# the -P option in the two print commands below. This mitigating
# accidental variable expansion, e.g. of the variables in the
# command string (V).
functions[_ksi_precmd]+="
builtin print -Prnu $_ksi_fd \$'\\e]2;'\"%m: \${(%):-%(4~|…/%3~|%~)}\"\$'\\a'"
builtin print -rnu $_ksi_fd \$'\\e]2;'\"$hostname: \${(%):-%(4~|…/%3~|%~)}\"\$'\\a'"
functions[_ksi_preexec]+="
builtin print -Prnu $_ksi_fd \$'\\e]2;'\"%m: \${(V)1}\"\$'\\a'"
builtin print -rnu $_ksi_fd \$'\\e]2;'\"$hostname: \${(V)1}\"\$'\\a'"
else
functions[_ksi_precmd]+="
builtin print -rnu $_ksi_fd \$'\\e]2;'\"\${(%):-%(4~|…/%3~|%~)}\"\$'\\a'"
Expand Down

0 comments on commit 39629db

Please sign in to comment.