Skip to content

Commit

Permalink
refactor: vterm
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed Jul 11, 2024
1 parent b2d3894 commit ec27cf3
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions .zshrc.local
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ fi
# For Emacs vterm
if [ -n "$INSIDE_EMACS" ]; then
DISABLE_AUTO_TITLE="true"
# ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=gray,underline'
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#525252'

# VTerm
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
function vterm_printf(){
if [ -n "$TMUX" ]; then
# tell tmux to pass the escape sequences through
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)
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)
Expand All @@ -51,15 +50,7 @@ if [ -n "$INSIDE_EMACS" ]; then
fi
}

function vterm_prompt_end() {
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)";
}

setopt PROMPT_SUBST
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'

alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear'
alias reset='vterm_printf "51;Evterm-clear-scrollback";tput clear'
fi
fi

Expand Down

0 comments on commit ec27cf3

Please sign in to comment.