From 4aed342a4e8d1ae53cd277eab0519d5205c219a2 Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Mon, 6 Oct 2025 13:32:01 +0100 Subject: [PATCH] Enable OSC 7 integration between zsh and foot --- home/dot_zshrc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/home/dot_zshrc b/home/dot_zshrc index 1e1a3f2..dce8a61 100644 --- a/home/dot_zshrc +++ b/home/dot_zshrc @@ -60,3 +60,16 @@ sri() { eval "$(starship init zsh)" eval "$(direnv hook zsh)" + +# Let the terminal know the current directory. OSC 7 +function osc7-pwd() { + 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 chpwd-osc7-pwd() { + (( ZSH_SUBSHELL )) || osc7-pwd +} +add-zsh-hook -Uz chpwd chpwd-osc7-pwd