diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-05-30 11:19:47 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-05-30 21:58:10 -0700 |
commit | e6faede2cbbd1208bc422b78ba52e576bb336be7 (patch) | |
tree | 6dc21c7d00b6dedb6927db7fb9d10e148ee77f5a /.bashrc | |
parent | e715ce0be05da5a61dce05b1868720c61927598d (diff) | |
download | dotfiles-e6faede2cbbd1208bc422b78ba52e576bb336be7.tar.gz |
don't include ANSI control chars in PS1 on TERM=dumb
Diffstat (limited to '.bashrc')
-rw-r--r-- | .bashrc | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -4,17 +4,19 @@ . $HOME/.shenv # '>' is a nice prompt char because it need not be followed by a -# space. It is easy to distinguish the command from the prompt -PS1='\[\e[1m\]$(exit_code=$?; test $exit_code -eq 0 || printf %s $exit_code " ")${debian_chroot:+($debian_chroot)}\u@\h:\w>\[\e[0m\]' +# space. It is easy to distinguish the command from the prompt. +# +# This satisfies both `shell-prompt-pattern' and `tramp-shell-prompt-pattern'. +PS1='$(exit_code=$?; test $exit_code -eq 0 || printf %s $exit_code " ")${debian_chroot:+($debian_chroot)}\u@\h:\w>' -# if this is an xterm set its title to user@host:dir -# (this doesn't stop the likes of ncmpcpp setting a title) case "$TERM" in + # if this is an xterm set its title to user@host:dir + # (this doesn't stop the likes of ncmpcpp setting a title) xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h:\w\a\]$PS1" - ;; - *) - ;; +PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h:\w\a\]\[\e[1m\]$PS1\[\e[0m\]" + ;; + 80-column|dumb|unknown) ;; + *) PS1="\[\e[1m\]$PS1\[\e[0m\]" ;; esac # enable better completion |