Enable vterm directory and prompt tracking

This commit is contained in:
Tobias Ostner 2024-06-14 10:00:49 +02:00
parent d17a912bb3
commit 41dbda027d
2 changed files with 20 additions and 3 deletions

19
nix/config/zsh/zshrc Normal file
View file

@ -0,0 +1,19 @@
eval "$(/opt/homebrew/bin/brew shellenv)"
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
}
vterm_prompt_end() {
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)"
}
setopt PROMPT_SUBST
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'