Skip to content

Only modify the prompt if the shell is in vterm #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion etc/emacs-vterm-bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion etc/emacs-vterm-zsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 11 additions & 9 deletions etc/emacs-vterm.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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