.profile 2.7 KB

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