From 3dc9df2003e9b264ca4fc2b0054e7fdef6305361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Thu, 10 Mar 2022 00:14:20 +0100 Subject: [PATCH] zsh: vterm directory --- shell/.zshrc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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() {