diff --git a/bash/environment b/bash/environment index 17339da..18abfb9 100644 --- a/bash/environment +++ b/bash/environment @@ -36,6 +36,3 @@ fi if [ "$TERM" == xterm ]; then export TERM=xterm-256color fi - -[[ -f ~/.nvm/nvm.sh ]] && source ~/.nvm/nvm.sh -[[ -r $NVM_DIR/bash_completion ]] && source $NVM_DIR/bash_completion diff --git a/bash/functions b/bash/functions index a1dd6b1..5a9c889 100644 --- a/bash/functions +++ b/bash/functions @@ -1,31 +1,17 @@ #!/usr/bin/env bash function min-jpg { - tmpfile=$(mktemp) + tmpfile="$(mktemp)" ogfile="$1" - jpegtran -optimize -perfect -outfile $tmpfile $ogfile - mv $tmpfile $ogfile + jpegtran -optimize -perfect -outfile "$tmpfile" "$ogfile" + mv "$tmpfile" $ogfile } function min-png { - tmpfile=$(mktemp) + tmpfile="$(mktemp)" ogfile="$1" - pngcrush -rem alla -reduce -brute $ogfile $tmpfile - mv $tmpfile $ogfile -} - -function parse_git_status { - if [[ $(git status 2> /dev/null | wc -l) -eq 0 ]]; then - return - fi - - if [[ $(git status 2> /dev/null | grep -E "working tree|directory clean" | wc -l) -eq 0 ]]; then - echo ' ∓' - fi -} - -function parse_git_branch { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' + pngcrush -rem alla -reduce -brute "$ogfile" "$tmpfile" + mv "$tmpfile" "$ogfile" } function get-create-date { @@ -42,16 +28,3 @@ function add-date-prefix { function get-bitrate { exiftool -AudioBitrate "$1" | awk '{print $4}' } - -function _hostname-color { - case "$(whoami)" in - william) echo $blue;; - buddy) echo $blue;; - root) echo $bred;; - *) echo $purple;; - esac -} - -function _hostname-show { - hostname -s | tr '[A-Z]' '[a-z]' -} diff --git a/bash/prompt b/bash/prompt index 27a6a44..4600d2b 100644 --- a/bash/prompt +++ b/bash/prompt @@ -15,3 +15,30 @@ PS1="$PS1\[$yellow\]"'$(parse_git_status) ' PS1="$PS1\[$purple\]\D{%F %I:%M%P} " # display date PS1="$PS1\[$color_off\]\nλ " + +function parse_git_status { + if [[ $(git status 2> /dev/null | wc -l) -eq 0 ]]; then + return + fi + + if [[ $(git status 2> /dev/null | grep -E "working tree|directory clean" | wc -l) -eq 0 ]]; then + echo ' ∓' + fi +} + +function _hostname-color { + case "$(whoami)" in + william) echo $blue;; + buddy) echo $blue;; + root) echo $bred;; + *) echo $purple;; + esac +} + +function _hostname-show { + hostname -s | tr '[A-Z]' '[a-z]' +} + +function parse_git_branch { + git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' +} diff --git a/profile b/profile index 9ca6228..c6d8309 100644 --- a/profile +++ b/profile @@ -1,18 +1,13 @@ #!/usr/bin/env bash -# if running bash -if [ -n "$BASH_VERSION" ]; then - # include .bashrc if it exists - if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" - fi -fi - export LANGUAGE="en_US:en" export LC_MESSAGES="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8" export LC_COLLATE="en_US.UTF-8" -# Load RVM into a shell session *as a function* -[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" +export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:="$HOME/.config"} +export XDG_CACHE_HOME=${XDG_CACHE_HOME:="$HOME/.cache"} +export XDG_DATA_HOME=${XDG_DATA_HOME:="$HOME/.local/share"} +[[ -f ~/.nvm/nvm.sh ]] && source ~/.nvm/nvm.sh +[[ -r $NVM_DIR/bash_completion ]] && source $NVM_DIR/bash_completion