Permalink
Browse files

Initial porting of zsh to bash config.

  • Loading branch information...
0 parents commit 1c009a5ce54ae2e6f2b4b01157d936b5ae756667 David Reid committed Jan 8, 2011
Showing with 68 additions and 0 deletions.
  1. +3 −0 dotbash_profile
  2. +5 −0 dotbashrc
  3. +7 −0 dreid.sh
  4. +5 −0 dreid/git.sh
  5. +31 −0 dreid/prompt.sh
  6. +1 −0 dreid/shopts.sh
  7. +16 −0 install.py
@@ -0,0 +1,3 @@
+if [ -f ~/.bashrc ]; then
+ source ~/.bashrc;
+fi
@@ -0,0 +1,5 @@
+if [ -z "$PS1" ]; then
+ return
+fi
+
+source ~/.bash.d/dreid.sh
@@ -0,0 +1,7 @@
+pushd ~/.bash.d/dreid > /dev/null
+
+source shopts.sh
+source git.sh
+source prompt.sh
+
+popd > /dev/null
@@ -0,0 +1,5 @@
+GIT_COMP="/usr/local/etc/bash_completion.d/git-completion.bash";
+source $GIT_COMP
+
+GIT_PS1_SHOWDIRTY_STATE=t
+GIT_PS1_SHOWUPSTREAM="auto"
@@ -0,0 +1,31 @@
+ALT_HOST_COLOR_BASES=(
+ "0;32m" # Green
+ "0;36m" # Cyan
+ "0;35m" # Purple
+ "0;33m" # Brown
+ "1;30m" # Dark Gray
+ "1;32m" # Light Green
+ "1;36m" # Light Cyan
+ "1;35m" # Light Purple
+);
+
+HOST_COLOR="\e[1;31m";
+USER_COLOR="\e[1;34m";
+NO_COLOR="\e[0m";
+
+case $TERM in
+ xterm*)
+ TITLE_STRING="\[\033]0;\u@\h:\w \$(__git_ps1 \" (%s)\")\007\]"
+ ;;
+ *)
+ TITLE_STRING=''
+ ;;
+esac
+
+if [[ -n "${SSH_CONNECTION}" ]]; then
+ hash=$(python -c "print abs(hash(\"${HOSTNAME}\"))")
+ base=$(expr ${hash} % ${#ALT_HOST_COLOR_BASES})
+ HOST_COLOR="\e[${ALT_HOST_COLOR_BASES[${base}]}"
+fi
+
+PS1="${TITLE_STRING}${HOST_COLOR}\h ${USER_COLOR}\u${NO_COLOR}:\W\$(__git_ps1 \" (%s)\")> "
@@ -0,0 +1 @@
+shopt -s checkwinsize
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+import os
+
+def l(target, new):
+ target = os.path.abspath(os.path.expanduser(target))
+ new = os.path.abspath(os.path.expanduser(new))
+ if os.path.exists(new):
+ print "{0} exists".format(new)
+ else:
+ os.symlink(target, new)
+
+
+if __name__ == '__main__':
+ l('dotbashrc', '~/.bashrc')
+ l('dotbash_profile', '~/.bash_profile')
+ l('.', '~/.bash.d')

0 comments on commit 1c009a5

Please sign in to comment.