at master 527 B view raw
1function osc7-pwd() { 2 emulate -L zsh # also sets localoptions for us 3 setopt extendedglob 4 local LC_ALL=C 5 printf '\e]7;file://%s%s\e\' $HOST ${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}} 6} 7 8function chpwd-osc7-pwd() { 9 (( ZSH_SUBSHELL )) || osc7-pwd 10} 11 12precmd() { 13 print -Pn "\e]133;A\e\\" 14} 15 16function precmd { 17 if ! builtin zle; then 18 print -n "\e]133;D\e\\" 19 fi 20} 21 22function preexec { 23 print -n "\e]133;C\e\\" 24} 25 26autoload -U add-zsh-hook 27add-zsh-hook -Uz chpwd chpwd-osc7-pwd