.profile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ###############################################################################
  2. # Non-interactive shell configuration
  3. ###############################################################################
  4. OS=$(uname -s)
  5. # Add $HOME/bin to PATH
  6. export PATH="$PATH:$HOME/bin"
  7. # Homebrew
  8. export PATH="$PATH:$HOME/homebrew/bin"
  9. BREW_BIN=$(which brew)
  10. BREW_PREFIX=$(which brew &>/dev/null && brew --prefix || echo "")
  11. if [ "$BREW_BIN" ]; then
  12. export PYTHONPATH="$BREW_PREFIX/lib/python2.7/site-packages/" # also facilitates: easy_install -d "$PYTHONPATH" awesome_pkg
  13. export HOMEBREW_CASK_OPTS="--caskroom=$BREW_PREFIX/Caskroom --binarydir=$BREW_PREFIX/bin"
  14. fi
  15. # Default editor
  16. export EDITOR="vim"
  17. # Configure go lang
  18. if [ "$OS" = "Darwin" ]; then
  19. export GOROOT="$BREW_PREFIX/opt/go"
  20. else
  21. export GOROOT="$HOME/golang"
  22. fi
  23. export PATH="$PATH:$GOROOT/bin"
  24. export GOPATH="$HOME/go"
  25. export PATH="$PATH:$GOPATH/bin"
  26. # Configure less allow colors
  27. export LESS="-FRX"
  28. # If not running interactively, don't do anything else
  29. [ "$PS1" ] || return
  30. ###############################################################################
  31. # Interactive shell configuration
  32. ###############################################################################
  33. # tweak history behavior a bit
  34. HISTSIZE=50000
  35. HISTFILESIZE=500000
  36. HISTCONTROL="ignoredups:ignorespace"
  37. shopt -s histappend
  38. # check window size after each command
  39. shopt -s checkwinsize
  40. # Custom shell aliases
  41. if [ "$OS" = "Darwin" ]; then
  42. alias ls="ls -G -CF"
  43. else
  44. alias ls="ls --color -CF"
  45. fi
  46. alias ll="ls -alF"
  47. alias la="ls -A"
  48. alias l="ls"
  49. alias d="ls"
  50. alias grep="grep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
  51. alias egrep="egrep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
  52. alias fgrep="fgrep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
  53. alias tree="tree -CF"
  54. # color diffs
  55. ! which colordiff &>/dev/null || alias diff="colordiff"
  56. # MacVim shell aliases
  57. if [ "$OS" = "Darwin" ]; then
  58. alias gvim="mvim"
  59. fi
  60. # bash completion FTW
  61. if [ "$OS" = "Darwin" ]; then
  62. ! [ -f "$BREW_PREFIX/etc/bash_completion" ] || . "$BREW_PREFIX/etc/bash_completion"
  63. else
  64. ! [ -f "/etc/bash_completion" ] || . "/etc/bash_completion"
  65. fi
  66. # Git shell aliases
  67. F="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash"; ! [ -f "$F" ] || . "$F"
  68. # Liquid Prompt
  69. F="$HOME/.liquidprompt/liquidprompt"; ! [ "$PS1" -a -f "$F" ] || . "$F"
  70. # gimme gimme
  71. [ -d "$HOME/.gimme" ] || curl -fsSL "https://github.com/KylePDavis/gimme/raw/master/gimme" | bash -
  72. ! [ -f "$HOME/.gimme/gimme" ] || . "$HOME/.gimme/gimme"