.profile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. ###############################################################################
  2. # Non-interactive shell configuration
  3. ###############################################################################
  4. OS=$(uname -s)
  5. # Add user-specific bin dirs to PATH
  6. export PATH="$PATH:$HOME/.local/bin:$HOME/bin"
  7. # Setup user-specific Python overrides
  8. if [ "$OS" = "Darwin" ]; then
  9. export PATH="$HOME/Library/Python/2.7/bin:$PATH:$HOME/bin"
  10. fi
  11. # Homebrew
  12. if [ "$OS" = "Darwin" ]; then
  13. export PATH="$PATH:$HOME/homebrew/bin"
  14. BREW_BIN=$(which brew)
  15. BREW_PREFIX=$(which brew &>/dev/null && brew --prefix || echo "")
  16. if [ "$BREW_BIN" ]; then
  17. export HOMEBREW_CASK_OPTS="--caskroom=$BREW_PREFIX/Caskroom --appdir=$HOME/Applications"
  18. fi
  19. fi
  20. # Default editor
  21. export EDITOR="vim"
  22. # Help things find Google Chrome
  23. if [ "$OS" = "Darwin" ]; then
  24. CHROME_BIN="$HOME/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
  25. ! [ -f "$CHROME_BIN" ] || export CHROME_BIN
  26. fi
  27. # Configure go lang
  28. if [ "$OS" = "Darwin" ]; then
  29. export GOROOT="$BREW_PREFIX/opt/go/libexec"
  30. else
  31. export GOROOT="$HOME/golang"
  32. fi
  33. export PATH="$PATH:$GOROOT/bin"
  34. export GOPATH="$HOME/go"
  35. export PATH="$PATH:$GOPATH/bin"
  36. # Configure less allow colors
  37. export LESS="-FRX"
  38. # If not running interactively, don't do anything else
  39. [ "$PS1" ] || return
  40. ###############################################################################
  41. # Interactive shell configuration
  42. ###############################################################################
  43. # tweak history behavior a bit
  44. HISTSIZE=50000
  45. HISTFILESIZE=500000
  46. HISTCONTROL="ignoreboth"
  47. shopt -s histappend
  48. # check window size after each command
  49. shopt -s checkwinsize
  50. # Custom shell aliases
  51. if [ "$OS" = "Darwin" ]; then
  52. export CLICOLOR="1"
  53. else
  54. alias ls="ls --color=auto"
  55. fi
  56. alias d="l"
  57. alias l="ls -CF"
  58. alias la="ls -A"
  59. alias ll="ls -alF"
  60. alias tree="tree -CF"
  61. export GREP_OPTIONS="--color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
  62. # color diffs
  63. ! which colordiff &>/dev/null || alias diff="colordiff"
  64. # color json
  65. ! which json &>/dev/null || alias json="json -o inspect"
  66. # MacVim shell aliases
  67. if [ "$OS" = "Darwin" ]; then
  68. alias gvim="mvim"
  69. fi
  70. # bash completion FTW
  71. if [ "$OS" = "Darwin" ]; then
  72. F="$BREW_PREFIX/etc/bash_completion"; ! [ -f "$F" ] || . "$F"
  73. F="$(xcode-select -p)/usr/share/git-core/git-completion.bash"; ! [ -f "$F" ] || . "$F"
  74. else
  75. F="/etc/bash_completion"; ! [ -f "$F" ] || . "$F"
  76. fi
  77. # Liquid Prompt
  78. F="$HOME/.liquidprompt/liquidprompt"; ! [ -f "$F" ] || . "$F"
  79. # gimme gimme
  80. [ -d "$HOME/.gimme" ] || curl -fsSL "https://github.com/KylePDavis/gimme/raw/master/gimme" | bash -
  81. F="$HOME/.gimme/gimme"; ! [ -f "$F" ] || . "$F"