X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=rc%2Ffunctions;h=458a69bbb653735a5b45e44b4c8252ff762cb49e;hb=96f05d12c02652390dece461964b5bd399669655;hp=fd373a2da2d5b4f21c6135b8e920ae129127d873;hpb=020a4a5ea2be725b155cae3a2cadc9aba3911b9b;p=clearscm.git diff --git a/rc/functions b/rc/functions index fd373a2..458a69b 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*}" @@ -38,6 +44,11 @@ function title_bar { current_dir="$current_dir ($(cat CVS/Root | tr -d $CR))" fi + # Add GIT info if available + if in_git_repo; then + current_dir="$current_dir [git: $(git branch | sed -n -e 's/^\* \(.*\)/\1/p')]" + fi + if [ "$TERM" = "hpterm" -o \ "$TERM" = "hp" -o \ "$TERM" = "2392A" ]; then @@ -48,7 +59,7 @@ 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\]" + PS1="\[\e]0;$prefix$current_dir\a$ROOT\e[01;33m\]$SYSNAME:\[\e[0m\]" fi } # title_bar @@ -91,7 +102,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##*:}" @@ -184,7 +195,7 @@ function ssh { } # ssh function sj { - if [ $ARCH = "FreeBSD" ]; then + if [ $ARCHITECTURE = "FreeBSD" ]; then psopts="-aux" else psopts="-ef"