diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-09-12 09:11:40 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-09-12 09:11:40 -0300 |
commit | 3219173f27fe88ec076e3b65bb47eede82b9adf0 (patch) | |
tree | 8c38559332d9c19b66169b02852b213ea5a1900a | |
parent | 0526bb5e62f69c48c0741addd6896babeba3c1a4 (diff) | |
download | profile-3219173f27fe88ec076e3b65bb47eede82b9adf0.tar.gz profile-3219173f27fe88ec076e3b65bb47eede82b9adf0.tar.bz2 |
Special cd builtin
-rw-r--r-- | profile.dot.link | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/profile.dot.link b/profile.dot.link index 74f1286..b256a7d 100644 --- a/profile.dot.link +++ b/profile.dot.link @@ -28,8 +28,16 @@ fi # Export PATH export PATH=$PATH +# Where most projects live +export WORKPATH="~/code:~/data:~/file:~/apps" + # See http://www.caliban.org/bash/#bashtips -export CDPATH=".:~:~/code:~/data:~/file:~/apps:/var/www/data" +export CDPATH=".:~:$WORKPATH" + +# Expand workpath +#for folder in `echo $WORKPATH | sed -e "s|:| |g" -e "s|~|$HOME|g"`; do +# PROJECTS="$PROJECTS`ls -d $folder/*`" +#done # Based on http://superuser.com/questions/90535/how-do-i-turn-of-auto-echo-in-bash-when-i-cd cd() { @@ -40,17 +48,30 @@ cd() { fi # Check if its a project under CPATH - project=`command cd "${destination}" 2> /dev/null` + cdpath=`command cd "${destination}" 2> /dev/null` # Got to folder command cd "${destination}" > /dev/null # Update screen title - if [ ! -z "$project" ] && [ ! -z "$STY" ]; then - #if [ "$project" == "`basename $project`" ]; then - stitle `basename $project` - #fi - fi + # + # Doesn't deal about getting out of a project path + # or if going into a project subfolder + # + #if [ ! -z "$cdpath" ] && [ ! -z "$STY" ]; then + # folder="`basename $cdpath`" + # + # if echo "$PROJECTS" | grep -q "/$folder$"; then + # # Got inside a project folder + # stitle `basename $folder` + # fi + #fi +} + +# Special cd: change folder and set title +scd() { + cd "$*" + stitle `basename $*` } # Default editor |