zsh: vterm directory

This commit is contained in:
Łukasz Pankowski 2022-03-10 00:14:20 +01:00
parent 5536588192
commit 3dc9df2003

View File

@ -55,6 +55,28 @@ if [[ "$TERM" == (alacritty*|gnome*|konsole*|putty*|rxvt*|screen*|tmux*|xterm*)
add-zsh-hook -Uz preexec xterm_title_preexec
fi
# Vterm directory.
function vterm_printf () {
if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ] ); then
# Tell tmux to pass the escape sequences through
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}
function vterm_prompt_end () {
vterm_printf "51;A$(pwd)";
}
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
add-zsh-hook -Uz chpwd vterm_prompt_end
fi
# Plugins.
source_if_exists() {