[zsh] OSC 7 hook

This commit is contained in:
odrling 2023-10-24 06:25:27 +02:00
parent d91a05bf93
commit f0da1d9293
No known key found for this signature in database
GPG key ID: A0145F975F9F8B75

12
.zshrc
View file

@ -43,6 +43,18 @@ else
promptinit; prompt gentoo
fi
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
# completion settings
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**'