summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-08-12 09:36:11 -0400
committerColin Walters <walters@verbum.org>2010-08-12 09:36:11 -0400
commit7fabf88041d4594b6ddeb4b22323c66677e31c3e (patch)
tree390b277e0c8b4b1eba5d901812790a60a16fc918
parent917759108c232f4ca72493325d004859cdb55855 (diff)
downloadhomegit-MOVED-TO-GNOME-7fabf88041d4594b6ddeb4b22323c66677e31c3e.zip
homegit-MOVED-TO-GNOME-7fabf88041d4594b6ddeb4b22323c66677e31c3e.tar.gz
homegit-MOVED-TO-GNOME-7fabf88041d4594b6ddeb4b22323c66677e31c3e.tar.xz
[bashrc] Show parent dir in prompt too for context
-rw-r--r--dotfiles/bashrc19
1 files changed, 18 insertions, 1 deletions
diff --git a/dotfiles/bashrc b/dotfiles/bashrc
index a9ab53c..5077eca 100644
--- a/dotfiles/bashrc
+++ b/dotfiles/bashrc
@@ -16,6 +16,23 @@ shopt -s histappend
EDITOR="emacsclient"
export EDITOR
+_format_wd ()
+{
+ pwd=$(pwd)
+ base=$(basename $pwd)
+ parent=$(basename $(dirname $pwd))
+ pparent=$(basename $(dirname $parent))
+ if test pparent != "/"; then
+ echo "$parent/$base"
+ else
+ if test parent != "/"; then
+ echo "/$parent/base"
+ else
+ echo "/$base"
+ fi
+ fi
+}
+
_format_inroot_dir ()
{
if test -z "$INROOT_DIR" && test -n "$CERTIFIED_GNOMIE"; then
@@ -34,7 +51,7 @@ _format_uid ()
fi
}
-PS1_PREFIX='\W$(_format_uid)$(_format_inroot_dir)'
+PS1_PREFIX='$(_format_wd)$(_format_uid)$(_format_inroot_dir)'
if test -n "$BASH_COMPLETION" && test -f /etc/bash_completion.d/git; then
PS1_PREFIX="$PS1_PREFIX"'$(__git_ps1 " [git %s]")'
fi