aboutsummaryrefslogtreecommitdiff
path: root/home/.bashrc.d
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2016-06-29 20:23:51 -0700
committerJakob Odersky <jakob@odersky.com>2016-06-29 20:23:51 -0700
commitf6656487d7b728cffb584d7558074d3850f0d322 (patch)
treee28c647822022768462c71a30a0825d0f3bc1db0 /home/.bashrc.d
parentc6de9798db512d020fdf7cda061376add50f04e9 (diff)
downloaddotfiles-f6656487d7b728cffb584d7558074d3850f0d322.tar.gz
dotfiles-f6656487d7b728cffb584d7558074d3850f0d322.tar.bz2
dotfiles-f6656487d7b728cffb584d7558074d3850f0d322.zip
Source custom scripts from directory
Diffstat (limited to 'home/.bashrc.d')
-rw-r--r--home/.bashrc.d/prompt.sh47
-rw-r--r--home/.bashrc.d/spark.sh2
2 files changed, 49 insertions, 0 deletions
diff --git a/home/.bashrc.d/prompt.sh b/home/.bashrc.d/prompt.sh
new file mode 100644
index 0000000..7471bc6
--- /dev/null
+++ b/home/.bashrc.d/prompt.sh
@@ -0,0 +1,47 @@
+export PROMPT_COMMAND=__prompt_command
+
+function __prompt_command() {
+ local EXIT="$?"
+ PS1=""
+ PS1+="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]"
+
+ local red='\[\033[0;31m\]'
+ local green='\[\033[0;32m\]'
+ local light_green='\[\033[01;32m\]'
+ local light_blue='\[\033[01;34m\]'
+ local reset='\[\033[0m\]'
+
+ PS1+="ā•­ "
+
+ if [ $EXIT = 0 ]; then
+ PS1+="${green}(āœ”)${reset} "
+ else
+ PS1+="${red}(āœ—)${reset} "
+ fi
+
+ PS1+="${debian_chroot:+($debian_chroot)}${light_green}\u@\h${reset}:${light_blue}\W${reset}"
+
+ ### Add Git Status ###
+ ## Inspired by http://www.terminally-incoherent.com/blog/2013/01/14/whats-in-your-bash-prompt/
+ if [[ $(command -v git) ]]; then
+ local git_status="$(git status --porcelain -b 2>/dev/null | tr '\n' ':')"
+
+ if [ "$git_status" ]; then
+ local git_color="${reset}"
+ ### Test For Changes ###
+ ## Change this to test for 'ahead' or 'behind'!
+ local git_changed="$(echo ${git_status} | tr ':' '\n' | grep -v "^$" | grep -v "^\#\#" | wc -l | tr -d ' ')"
+ if [ "$git_changed" == "0" ]; then
+ git_color="${green}"
+ else
+ git_color="${red}"
+ fi
+
+ ### Find Branch ###
+ local git_branch="$(echo ${git_status} | tr ':' '\n' | grep "^##" | cut -c4-)"
+ PS1+=" ${git_color}[${git_branch}]${reset}"
+ fi
+ fi
+
+ PS1+="\nā•°\$ ${RCol}"
+}
diff --git a/home/.bashrc.d/spark.sh b/home/.bashrc.d/spark.sh
new file mode 100644
index 0000000..30b8225
--- /dev/null
+++ b/home/.bashrc.d/spark.sh
@@ -0,0 +1,2 @@
+# Spark: don't run scalastyle on every compile
+export NOLINT_ON_COMPILE=true