X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=rc%2Ffunctions;h=39f705839fc1fb22101e26683b029a06e5a3b2fd;hb=f4cba91d9cce314c632afe2e05987670c0d1813e;hp=89bfb9f4ee3c2113ab5d2c707943182453e61bda;hpb=de4e859da4c5c71147fcd114a6efaf57d6565888;p=clearscm.git diff --git a/rc/functions b/rc/functions index 89bfb9f..39f7058 100644 --- a/rc/functions +++ b/rc/functions @@ -17,24 +17,15 @@ CR=$(echo "\015") view_name= -function in_git_repo { - pwd=$PWD - - while [ "$pwd" != "/" ]; do - if [ -d "$pwd/.git" ]; then - true; - return; - fi - - pwd=$(dirname $pwd) - done - - false -} # in_git_repo - # 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*}" @@ -68,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 @@ -111,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##*:}"