diff options
Diffstat (limited to 'tw/home/files/zshrc')
-rw-r--r-- | tw/home/files/zshrc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tw/home/files/zshrc b/tw/home/files/zshrc index ca4481e2..8a658173 100644 --- a/tw/home/files/zshrc +++ b/tw/home/files/zshrc @@ -189,3 +189,27 @@ fi load_plugin fast-syntax-highlighting || load_plugin zsh-syntax-highlighting + +## Terminal integration with foot +# https://codeberg.org/dnkl/foot/wiki#shell-integration +if [ "$TERM" = foot ]; then + function foot-osc7-pwd () { + (( ZSH_SUBSHELL )) && return 0 + emulate -L zsh # also sets localoptions for us + setopt extendedglob + local LC_ALL=C + printf '\e]7;file://%s%s\e\' "$HOST" "${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}}" + } + function foot-precmd () { + print -Pn '\e]133;A\e\' + if ! builtin zle; then + print -n '\e]133;D\e\' + fi + } + function foot-preexec () { + print -n '\e]133;C\e\' + } + add-zsh-hook -Uz chpwd foot-osc7-pwd + add-zsh-hook -Uz precmd foot-precmd + add-zsh-hook -Uz preexec foot-preexec +fi |