]> git.phdru.name Git - dotfiles.git/blobdiff - .shellrc
bash: Separate host from current dir in `PS1` with `:`
[dotfiles.git] / .shellrc
index 10b3e9b18acbbfacdeee0f576bee1e9a3f6d538d..6973d7ab0a04a70423b66f9290b2eb96a8a18ccb 100644 (file)
--- a/.shellrc
+++ b/.shellrc
@@ -57,10 +57,7 @@ case "$HOME" in
    ;;
 esac
 
-
-OPS1="$OPS1\\$"
-PS1="$OPS1 "
-
+PS1="$OPS1$SHLVL "
 
 if test -n "$BASH_VERSION"; then
    [ "`type -t ls`" = alias ] && unalias ls
@@ -98,12 +95,6 @@ if test -n "$BASH_VERSION"; then
       fi
    fi
 
-   if [ -d "$HOME"/.bash_completion.d ]; then
-      for _compf in "$HOME"/.bash_completion.d/*; do
-         . $_compf
-      done
-   fi
-
    for cmd in builtin cgmem_nice command dbus-launch exec \
       killall man nice nohup pidof pidOf KillAll pgrep pkill psg pswg su sudo \
       time whence whereis which xargs; do
@@ -122,6 +113,12 @@ if test -n "$BASH_VERSION"; then
          ! has_completion $cmd && complete -o default -A hostname $cmd
    done
 
+   if [ -d "$HOME"/.bash_completion.d ]; then
+      for _compf in "$HOME"/.bash_completion.d/*; do
+         . $_compf
+      done
+   fi
+
    delegate_completion() {
       local prog programs
       prog=$1
@@ -154,6 +151,13 @@ if test -n "$BASH_VERSION"; then
    fi
    complete -W "`echo $BROWSER | sed 's/:/ /g'`" start-browser
 
+   if [ "`type -t short_curdir`" != function -a \
+         -r "$HOME"/admin/prog/bash_prompt ]; then
+      . "$HOME"/admin/prog/bash_prompt
+   fi
+
+   PS1="\`cgmem_which_prompt\`$OPS1$SHLVL "
+
    #if type -p pip >/dev/null 2>&1; then
    #   eval "`pip completion --bash`"
    #   rm -rf /tmp/pip_build_"$USER"
@@ -338,7 +342,11 @@ include() {
 mc() {
    if test -n "$BASH_VERSION"; then
       MC_SAVE_OPS1="$OPS1"
-      OPS1="\u@\h "
+      if [ "`type -t short_curdir`" = function ]; then
+         OPS1="\u@\${HOSTNAME::5}:\`short_curdir\` \\$"
+      else
+         OPS1="\u@\h:\W \\$"
+      fi
    fi
 
    if [ -n "$SLOWTERM" ]; then