Last active
January 31, 2018 05:36
-
-
Save crast/0e1fcadfdae814d47439dda8b0926e37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_chpwd() { | |
if [[ "$PWD" == */src/* || "$PWD" == */src ]]; then | |
GPNEW=$(echo $PWD | sed -e 's#/src.*##') | |
elif [ -d src ]; then | |
GPNEW=`pwd` | |
fi | |
if [[ "$GPNEW" != "" && "$GPNEW" != "$GOPATH" ]]; then | |
export GOPATH="$GPNEW" | |
echo "GOPATH=$GOPATH" | |
fi | |
} | |
_chpwd | |
cd() { builtin cd "$@" && _chpwd; } | |
pushd() { builtin pushd "$@" && _chpwd; } | |
popd() { builtin popd "$@" && _chpwd; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
# If this is an xterm set the title to user@host:dir | |
case "$TERM" in | |
xterm*|rxvt*) | |
PS1="\[\e]0;\u@\h: \w\a\]$PS1" | |
;; | |
*) | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment