|
@@ -1,29 +1,83 @@
|
|
|
+###############################################################################
|
|
|
+# Non-interactive shell configuration
|
|
|
+###############################################################################
|
|
|
+
|
|
|
+OS=$(uname -s)
|
|
|
+
|
|
|
+# Add $HOME/bin to PATH
|
|
|
export PATH="$PATH:$HOME/bin"
|
|
|
|
|
|
# Homebrew
|
|
|
export PATH="$PATH:$HOME/homebrew/bin"
|
|
|
-export PYTHONPATH="$(brew --prefix)/lib/python2.7/site-packages/" # also facilitates: easy_install -d "$PYTHONPATH" awesome_pkg
|
|
|
+BREW_BIN=$(which brew)
|
|
|
+BREW_PREFIX=$(which brew &>/dev/null && brew --prefix || echo "")
|
|
|
+if [ "$BREW_BIN" ]; then
|
|
|
+ export PYTHONPATH="$BREW_PREFIX/lib/python2.7/site-packages/" # also facilitates: easy_install -d "$PYTHONPATH" awesome_pkg
|
|
|
+ export HOMEBREW_CASK_OPTS="--caskroom=$BREW_PREFIX/Caskroom --binarydir=$BREW_PREFIX/bin"
|
|
|
+fi
|
|
|
+
|
|
|
+# Default editor
|
|
|
+export EDITOR="vim"
|
|
|
+
|
|
|
+# Configure go lang
|
|
|
+if [ "$OS" = "Darwin" ]; then
|
|
|
+ export GOROOT="$BREW_PREFIX/opt/go"
|
|
|
+else
|
|
|
+ export GOROOT="$HOME/golang"
|
|
|
+fi
|
|
|
+export PATH="$PATH:$GOROOT/bin"
|
|
|
+export GOPATH="$HOME/go"
|
|
|
+export PATH="$PATH:$GOPATH/bin"
|
|
|
+
|
|
|
+# Configure less allow colors
|
|
|
+export LESS="-FRX"
|
|
|
+
|
|
|
+# If not running interactively, don't do anything else
|
|
|
+[ "$PS1" ] || return
|
|
|
+
|
|
|
+
|
|
|
+###############################################################################
|
|
|
+# Interactive shell configuration
|
|
|
+###############################################################################
|
|
|
+
|
|
|
+# tweak history behavior a bit
|
|
|
+HISTSIZE=50000
|
|
|
+HISTFILESIZE=500000
|
|
|
+HISTCONTROL="ignoredups:ignorespace"
|
|
|
+shopt -s histappend
|
|
|
|
|
|
-# Homebrew cask
|
|
|
-export HOMEBREW_CASK_OPTS="--caskroom=$HOME/homebrew/Caskroom --binarydir=$HOME/homebrew/bin"
|
|
|
+# check window size after each command
|
|
|
+shopt -s checkwinsize
|
|
|
|
|
|
# Custom shell aliases
|
|
|
-alias ls="ls -FG"
|
|
|
+if [ "$OS" = "Darwin" ]; then
|
|
|
+ alias ls="ls -G -CF"
|
|
|
+else
|
|
|
+ alias ls="ls --color -CF"
|
|
|
+fi
|
|
|
+alias ll="ls -alF"
|
|
|
+alias la="ls -A"
|
|
|
+alias l="ls"
|
|
|
alias d="ls"
|
|
|
-alias tree="tree -CF"
|
|
|
alias grep="grep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
|
|
|
+alias egrep="egrep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
|
|
|
+alias fgrep="fgrep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
|
|
|
+alias tree="tree -CF"
|
|
|
|
|
|
-# MacVim shell aliases
|
|
|
-alias gvim="mvim"
|
|
|
+# color diffs
|
|
|
+! which colordiff &>/dev/null || alias diff="colordiff"
|
|
|
|
|
|
-# Default editor
|
|
|
-export EDITOR="vim"
|
|
|
+# MacVim shell aliases
|
|
|
+if [ "$OS" = "Darwin" ]; then
|
|
|
+ alias gvim="mvim"
|
|
|
+fi
|
|
|
|
|
|
# bash completion FTW
|
|
|
-! [ -f "$(brew --prefix)/etc/bash_completion" ] || . "$(brew --prefix)/etc/bash_completion"
|
|
|
-
|
|
|
-# color diffs
|
|
|
-! which colordiff &>/dev/null || alias diff="colordiff"
|
|
|
+if [ "$OS" = "Darwin" ]; then
|
|
|
+ ! [ -f "$BREW_PREFIX/etc/bash_completion" ] || . "$BREW_PREFIX/etc/bash_completion"
|
|
|
+else
|
|
|
+ ! [ -f "/etc/bash_completion" ] || . "/etc/bash_completion"
|
|
|
+fi
|
|
|
|
|
|
# Git shell aliases
|
|
|
F="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash"; ! [ -f "$F" ] || . "$F"
|
|
@@ -31,18 +85,6 @@ F="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash";
|
|
|
# Liquid Prompt
|
|
|
F="$HOME/liquidprompt/liquidprompt"; ! [ "$PS1" -a -f "$F" ] || . "$F"
|
|
|
|
|
|
-# go lang
|
|
|
-export GOROOT="$(brew --prefix go)"
|
|
|
-export PATH="$PATH:$GOROOT/bin"
|
|
|
-export GOPATH="$HOME/go"
|
|
|
-export PATH="$PATH:$GOPATH/bin"
|
|
|
-
|
|
|
-# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
|
|
-HISTSIZE=50000
|
|
|
-HISTFILESIZE=500000
|
|
|
-
|
|
|
-# make less allow and use colors
|
|
|
-export LESS="-FRX"
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
@@ -97,15 +139,15 @@ _install_dev_sh() {
|
|
|
_install_dev_py() {
|
|
|
_install_homebrew
|
|
|
mkdir -p "$PYTHONPATH"
|
|
|
- PKG="pylint"; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
|
|
|
- PKG="pep8"; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
|
|
|
+ PKG="pylint"; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$BREW_PREFIX/bin/$PKG")
|
|
|
+ PKG="pep8"; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$BREW_PREFIX/bin/$PKG")
|
|
|
}
|
|
|
|
|
|
_install_dev_db() {
|
|
|
_install_homebrew
|
|
|
- which mongod >/dev/null || brew install mongodb && ln -sfv "$(brew --prefix mongodb)"/*.plist ~/Library/LaunchAgents/
|
|
|
- which redis >/dev/null || brew install redis && ln -sfv "$(brew --prefix redis)"/*.plist ~/Library/LaunchAgents/
|
|
|
- which pg_config || brew install postgresql && ln -sfv "$(brew --prefix postgrsql)"/*.plist ~/Library/LaunchAgents/
|
|
|
+ which mongod >/dev/null || brew install mongodb && ln -sfv "$BREW_PREFIX/opt/mongodb"/*.plist ~/Library/LaunchAgents/
|
|
|
+ which redis >/dev/null || brew install redis && ln -sfv "$BREW_PREFIX/opt/redis"/*.plist ~/Library/LaunchAgents/
|
|
|
+ which pg_config >/dev/null || brew install postgresql && ln -sfv "$BREW_PREFIX/opt/postgresql"/*.plist ~/Library/LaunchAgents/
|
|
|
}
|
|
|
|
|
|
_install_dev_go() {
|