From 827d7e1c3b6e4e1c4537ffed6249cb9e845ef4fd Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Thu, 25 May 2017 17:23:45 -0500 Subject: [PATCH] Re-structure \[$(tput setaf 4)\][\A]\[$(tput setaf 6)\][\[$(tput setaf 14)\]\u\[$(tput setaf 6)\]@\h \[$(tput setaf 13)\]bashrc\[$(tput sgr0)\] \[$(tput setaf 6)\]\W]\[$(tput sgr0)\]$ for better extensibility, add venv mixin --- .bashrc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.bashrc b/.bashrc index f47da37..764a50c 100644 --- a/.bashrc +++ b/.bashrc @@ -59,21 +59,26 @@ promptsetup() { local fg_magenta='\[$(tput setaf 13)\]' local fg_cyan='\[$(tput setaf 6)\]' local fg_brightcyan='\[$(tput setaf 14)\]' + local fg_green='\[$(tput setaf 2)\]' local reset='\[$(tput sgr0)\]' + local hostname='\h' + local mixin # [hh:mm][username@hostname pwd]$ if [ -n "$SSH_CLIENT" ]; then # Remotely, hostname is red. - PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@${fg_brightred}\h ${fg_cyan}\W]${reset}\$ " + hostname="${fg_brightred}\h${reset}" + + elif [ -n "$VIRTUAL_ENV" ]; then + # If in a vcsh repo env, add repo name in magenta. + mixin=" ${fg_green}$(basename $VIRTUAL_ENV)${reset}" elif [ -n "$VCSH_REPO_NAME" ]; then # If in a vcsh repo env, add repo name in magenta. - PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@\h ${fg_magenta}$VCSH_REPO_NAME ${fg_cyan}\W]${reset}\$ " - - else - # Locally, hostname is cyan. - PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@\h \W]${reset}\$ " + mixin=" ${fg_magenta}$VCSH_REPO_NAME${reset}" fi + + PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@${hostname}${mixin} ${fg_cyan}\W]${reset}\$ " } promptsetup