Permalink
Browse files

Initial commit

  • Loading branch information...
derekwyatt committed Mar 15, 2012
0 parents commit f36c699f3741cc6ec59dc6dc501a1f2a5f6fea86
Showing with 1,155 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +1 −0 README
  3. +122 −0 bashprompt
  4. +272 −0 bashrc
  5. +209 −0 dircolors
  6. +10 −0 inputrc
  7. +147 −0 source_these/aliases.sh
  8. +16 −0 source_these/git.sh
  9. +376 −0 zshrc
@@ -0,0 +1,2 @@
+*.sw[op]
+perforce.sh
1 README
@@ -0,0 +1 @@
+A set of dotfiles that I need
@@ -0,0 +1,122 @@
+#!/bin/bash
+
+set -o allexport
+function prompt_command
+{
+ TERMWIDTH=${COLUMNS}
+
+ hostnam=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
+
+ usernam=$(whoami)
+ cur_tty=$(tty | sed -e "s/.*tty\(.*\)/\1/")
+ newPWD="${PWD}"
+ gitBranch=$(git branch 2>/dev/null | grep '^\*' | cut -c3-)
+ if [[ -z "$gitBranch" ]]; then
+ gitBranch=" "
+ else
+ gitBranch="$gitBranch"
+ fi
+ let promptsize=$(echo -n "--(${usernam}@${hostnam})-[$gitBranch]-(${PWD})--" | wc -c | tr -d " ")
+ let fillsize=${TERMWIDTH}-${promptsize}
+ fill=""
+ while [ "$fillsize" -gt "0" ]
+ do
+ fill="${fill}-"
+ let fillsize=${fillsize}-1
+ done
+
+ if [ "$fillsize" -lt "0" ]
+ then
+ let cut=3-${fillsize}
+ newPWD="...$(echo -n $PWD | sed -e "s/\(^.\{$cut\}\)\(.*\)/\2/")"
+ fi
+}
+
+PROMPT_COMMAND=prompt_command
+
+function setXtermTitle
+{
+ export XTERM_TITLE=
+ if [ $TERM == xterm ]; then
+ if [ -n "$PERFORCE_PROJECT" ]; then
+ typeset proj="[$PERFORCE_PROJECT]"
+ else
+ typeset proj=
+ fi
+ typeset title="$proj"
+ if [ $# != 0 ]; then
+ title="$*${proj:+ $proj}"
+ fi
+ if [ -n "$title" ]; then
+ title="$title: "
+ fi
+ typeset h=
+ if [ "$HOSTNAME" != "dqw-linux" ]; then
+ h="$HOSTNAME:"
+ fi
+ XTERM_TITLE="\[\033]0;$h${title}\w\007\]"
+ else
+ XTERM_TITLE=
+ fi
+ twtty
+}
+
+alias st=setXtermTitle
+
+function twtty
+{
+ local GRAY="\[\033[1;30m\]"
+ local LIGHT_GRAY="\[\033[0;37m\]"
+ local WHITE="\[\033[1;37m\]"
+ local NO_COLOUR="\[\033[0m\]"
+
+ local LIGHT_BLUE="\[\033[1;34m\]"
+
+ local RED="\[\033[0;31m\]"
+ local BRIGHT_RED="\[\033[1;31m\]"
+
+ local CYAN="\[\033[0;36m\]"
+ local BRIGHT_CYAN="\[\033[1;36m\]"
+
+ local YELLOW="\[\033[0;33m\]"
+ local BRIGHT_YELLOW="\[\033[1;33m\]"
+
+ local GREEN="\[\033[0;32m\]"
+ local BRIGHT_GREEN="\[\033[1;32m\]"
+
+ if [ "$(hostname)" == "lambda.local" ]; then
+ ((SHLVL=SHLVL+1))
+ fi
+ if [ $SHLVL -lt 2 ]; then
+ local BASIC_TEXT="$GREEN"
+ local BRIGHT_TEXT="$BRIGHT_GREEN"
+ local DELIM_TEXT="$LIGHT_BLUE"
+ local BRANCH_TEXT="$BRIGHT_RED"
+ elif [ $SHLVL -lt 3 ]; then
+ local BASIC_TEXT="$YELLOW"
+ local BRIGHT_TEXT="$BRIGHT_YELLOW"
+ local DELIM_TEXT="$LIGHT_BLUE"
+ local BRANCH_TEXT="$BRIGHT_GREEN"
+ elif [ $SHLVL -lt 4 ]; then
+ local BASIC_TEXT="$CYAN"
+ local BRIGHT_TEXT="$BRIGHT_CYAN"
+ local DELIM_TEXT="$LIGHT_BLUE"
+ local BRANCH_TEXT="$BRIGHT_GREEN"
+ else
+ local BASIC_TEXT="$RED"
+ local BRIGHT_TEXT="$BRIGHT_RED"
+ local DELIM_TEXT="$LIGHT_BLUE"
+ local BRANCH_TEXT="$YELLOW"
+ fi
+ if [ "$(whoami)" = "root" ]; then
+ local USER_TEXT="\[\033[0;41m\]\[\033[1;37m\]"
+ else
+ local USER_TEXT=$BASIC_TEXT
+ fi
+
+ PS1="$XTERM_TITLE$BASIC_TEXT-$DELIM_TEXT-($USER_TEXT\$usernam$NO_COLOUR$DELIM_TEXT@$BASIC_TEXT\$hostnam${DELIM_TEXT})-${DELIM_TEXT}[${BRANCH_TEXT}\$gitBranch${DELIM_TEXT}]-($BRIGHT_TEXT\${newPWD}$DELIM_TEXT)-$BASIC_TEXT\${fill}$BASIC_TEXT-\n$BASIC_TEXT-$DELIM_TEXT->$NO_COLOUR "
+ PS2="$DELIM_TEXT-$BASIC_TEXT-$BASIC_TEXT-$NO_COLOUR "
+}
+
+setXtermTitle
+set +o allexport
Oops, something went wrong.

0 comments on commit f36c699

Please sign in to comment.