diff --git a/etc/emacs-vterm-bash.sh b/etc/emacs-vterm-bash.sh index 15bf3530..69bbade0 100644 --- a/etc/emacs-vterm-bash.sh +++ b/etc/emacs-vterm-bash.sh @@ -53,4 +53,6 @@ PROMPT_COMMAND='echo -ne "\033]0;\h:\w\007"' vterm_prompt_end(){ vterm_printf "51;A$(whoami)@$(hostname):$(pwd)" } -PS1=$PS1'\[$(vterm_prompt_end)\]' +if [[ "$INSIDE_EMACS" = 'vterm' ]]; then + PS1=$PS1'\[$(vterm_prompt_end)\]' +fi diff --git a/etc/emacs-vterm-zsh.sh b/etc/emacs-vterm-zsh.sh index b01f52de..bf0a4157 100644 --- a/etc/emacs-vterm-zsh.sh +++ b/etc/emacs-vterm-zsh.sh @@ -52,4 +52,6 @@ vterm_prompt_end() { vterm_printf "51;A$(whoami)@$(hostname):$(pwd)"; } setopt PROMPT_SUBST -PROMPT=$PROMPT'%{$(vterm_prompt_end)%}' +if [[ "$INSIDE_EMACS" = 'vterm' ]]; then + PROMPT=$PROMPT'%{$(vterm_prompt_end)%}' +fi diff --git a/etc/emacs-vterm.fish b/etc/emacs-vterm.fish index 25169a64..c866449a 100644 --- a/etc/emacs-vterm.fish +++ b/etc/emacs-vterm.fish @@ -56,13 +56,15 @@ function vterm_prompt_end; vterm_printf '51;A'(whoami)'@'(hostname)':'(pwd) end -# We are going to add a portion to the prompt, so we copy the old one -functions --copy fish_prompt vterm_old_fish_prompt +if [ "$INSIDE_EMACS" = 'vterm' ] + # We are going to add a portion to the prompt, so we copy the old one + functions --copy fish_prompt vterm_old_fish_prompt -function fish_prompt --description 'Write out the prompt; do not replace this. Instead, put this at end of your file.' - # Remove the trailing newline from the original prompt. This is done - # using the string builtin from fish, but to make sure any escape codes - # are correctly interpreted, use %b for printf. - printf "%b" (string join "\n" (vterm_old_fish_prompt)) - vterm_prompt_end -end + function fish_prompt --description 'Write out the prompt; do not replace this. Instead, put this at end of your file.' + # Remove the trailing newline from the original prompt. This is done + # using the string builtin from fish, but to make sure any escape codes + # are correctly interpreted, use %b for printf. + printf "%b" (string join "\n" (vterm_old_fish_prompt)) + vterm_prompt_end + end +fi