X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=rc%2Ffunctions;h=39f705839fc1fb22101e26683b029a06e5a3b2fd;hb=8826c0c08a0b80ad8fb85ab9ddee23bde612af0f;hp=18012885c8c281113734f72fba299e1a42b3768d;hpb=4485a622887eafc6174b305983301aa6ea46d4c9;p=clearscm.git diff --git a/rc/functions b/rc/functions index 1801288..39f7058 100644 --- a/rc/functions +++ b/rc/functions @@ -19,7 +19,13 @@ view_name= # Function to set the title bar. Works on the terminal emulators listed. function title_bar { + if [ $# -gt 1 ]; then + ROOT=shift + ROOT="${NORMAL}\($ROOT\)" + fi + prefix="$@" + # Change $HOME -> ~ if [ "${PWD#$HOME*}" != "$PWD" ]; then current_dir="~${PWD#$HOME*}" @@ -39,8 +45,8 @@ function title_bar { fi # Add GIT info if available - if [ -d .git ]; then - current_dir="git: $(git branch | sed -n -e 's/^\* \(.*\)/\1/p') $current_dir" + if in_git_repo; then + current_dir="$current_dir [git: $(git branch | sed -n -e 's/^\* \(.*\)/\1/p')]" fi if [ "$TERM" = "hpterm" -o \ @@ -53,7 +59,8 @@ function title_bar { string=$(echo "${SYSNAME##*:}:$@") echo -n "${ESC}]2;$string\007" elif [ "$TERM" = "cygwin" -o "$TERM" = "vt100" -o "$TERM" = "xterm" ]; then - PS1="\[\e]0;$prefix$current_dir\a\e[01;33m\]$SYSNAME:\[\e[0m\]" + # Here's where we set the prompt with root + PS1="\[\e]0;$prefix$current_dir\a$AQUA\]$ROOT\[$YELLOW\]$SYSNAME:\[$NORMAL\]" fi } # title_bar @@ -96,7 +103,7 @@ function set_title { view_name="" title_bar "$ROOT" else - title_bar "${ROOT}View: $view_name: " + title_bar "$ROOT" "View: $view_name: " fi icon_name "${SYSNAME##*:}"