diff --git a/dotfiles/bash/bashrc b/dotfiles/bash/bashrc index 86abed5..c7ba011 100644 --- a/dotfiles/bash/bashrc +++ b/dotfiles/bash/bashrc @@ -157,26 +157,30 @@ fi # ------------------------------------------ FORMATTING ------------------------------------------ # -# Better color handling so scrolling doesn't get broken. -# Note for Cygwin you need ncurses for this to work. -reset=$(tput sgr0) -green=$(tput setaf 2) -blue=$(tput setaf 4) -white=$(tput setaf 7) - -bold=$(tput bold || tput md) - -export PROMPT_DIRTRIM=2 - -# Important note for PS1 modification - everything non-printable must be escaped with `\[` and `\]`. Otherwise readline -# fails to track the prompt right and things get messed up when you input long strings. - -if [[ "$OSTYPE" == "linux-gnu" ]]; then - # I had some rendering issues running in XFCE unless I added an extra space at the end. - export PS1='\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]$(parse_git_branch)\[$reset\]\[$bold\]\[$white\]⇨\[$reset\] ' -else - export PS1='\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]$(parse_git_branch)\[$reset\]\[$bold\]\[$white\]⇨\[$reset\] ' +if [[ $- == *i* ]] +then + # Better color handling so scrolling doesn't get broken. + # Note for Cygwin you need ncurses for this to work. + reset=$(tput sgr0) + green=$(tput setaf 2) + blue=$(tput setaf 4) + white=$(tput setaf 7) + + bold=$(tput bold || tput md) + + export PROMPT_DIRTRIM=2 + + # Important note for PS1 modification - everything non-printable must be escaped with `\[` and `\]`. Otherwise readline + # fails to track the prompt right and things get messed up when you input long strings. + + if [[ "$OSTYPE" == "linux-gnu" ]]; then + # I had some rendering issues running in XFCE unless I added an extra space at the end. + export PS1='\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]$(parse_git_branch)\[$reset\]\[$bold\]\[$white\]⇨\[$reset\] ' + else + export PS1='\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]$(parse_git_branch)\[$reset\]\[$bold\]\[$white\]⇨\[$reset\] ' + fi fi + # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. export PATH="$PATH:$HOME/.rvm/bin"