diff --git a/shell/.zshrc b/shell/.zshrc index 4194415..df43135 100644 --- a/shell/.zshrc +++ b/shell/.zshrc @@ -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() {