Enable CWD reporting in the zsh integration

This commit is contained in:
Kovid Goyal
2022-03-15 14:30:21 +05:30
parent 946589d1f1
commit 4a1ad7755a
6 changed files with 21 additions and 4 deletions

View File

@@ -84,7 +84,7 @@ precmd_functions+=(_ksi_deferred_init)
_ksi_deferred_init() {
builtin emulate -L zsh -o no_warn_create_global -o no_aliases
# Recognized options: no-cursor, no-title, no-prompt-mark, no-complete.
# Recognized options: no-cursor, no-title, no-prompt-mark, no-complete, no-cwd.
builtin local -a opt
opt=(${(s: :)KITTY_SHELL_INTEGRATION})
builtin unset KITTY_SHELL_INTEGRATION
@@ -224,6 +224,13 @@ _ksi_deferred_init() {
# builtin print -nu "$_ksi_fd" "\\e]133;B\\a"'
fi
# Enable reporting current working dir to terminal
if (( ! opt[(Ie)no-cwd] )); then
_ksi_report_pwd() { builtin print -nu $_ksi_fd '\e]7;kitty-shell-cwd://'"$HOST""$PWD"'\a'; }
chpwd_functions=(${chpwd_functions[@]} "_ksi_report_pwd")
_ksi_report_pwd
fi
# Enable terminal title changes.
if (( ! opt[(Ie)no-title] )); then
# We don't use `print -P` because it depends on prompt options, which