.profile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. export PATH="$HOME/bin:$PATH"
  2. # Homebrew
  3. export PATH="$HOME/homebrew/bin:$PATH"
  4. export PYTHONPATH="$(brew --prefix)/lib/python2.7/site-packages/" # also facilitates: easy_install -d "$PYTHONPATH" awesome_pkg
  5. # Custom shell aliases
  6. alias ls="ls -FG"
  7. alias d="ls"
  8. alias tree='tree -CF'
  9. alias grep="grep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
  10. # MacVim shell aliases
  11. alias gvim="mvim"
  12. # Default editor
  13. export EDITOR="vim"
  14. # bash completion FTW
  15. ! [ -f "$(brew --prefix)/etc/bash_completion" ] || . "$(brew --prefix)/etc/bash_completion"
  16. # color diffs
  17. ! which colordiff &>/dev/null || alias diff="colordiff"
  18. # Git shell aliases
  19. F="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash"; ! [ -f "$F" ] || . "$F"
  20. # Liquid Prompt
  21. F="$HOME/liquidprompt/liquidprompt"; ! [ "$PS1" -a -f "$F" ] || . "$F"
  22. # go lang
  23. export GOPATH=$(brew --prefix)
  24. export PATH="$PATH:$(brew --prefix)/opt/go/libexec/bin"
  25. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  26. HISTSIZE=50000
  27. HISTFILESIZE=500000
  28. # make less allow and use colors
  29. export LESS="-FRX"
  30. ###############################################################################
  31. # Installers
  32. ###############################################################################
  33. _install_homebrew() {
  34. [ -d "$HOME/homebrew" ] || (mkdir "$HOME/homebrew" 2>/dev/null && curl -L "https://github.com/Homebrew/homebrew/tarball/master" | tar xz --strip 1 -C "$HOME/homebrew" && brew update)
  35. }
  36. _install_tools() {
  37. _install_homebrew
  38. [ -d "$HOME/liquidprompt" ] || git clone "https://github.com/nojhan/liquidprompt.git" "$HOME/liquidprompt"
  39. which tmux >/dev/null || brew install tmux
  40. which tree >/dev/null || brew install tree
  41. [ -f "$HOME/.bash_profile" ] || ln -sv "$HOME/.profile" "$HOME/.bash_profile"
  42. [ -f "$HOME/.bashrc" ] || ln -sv "$HOME/.profile" "$HOME/.bashrc"
  43. [ -f "$HOME/.gitconfig" ] || (
  44. git config --global color.ui true
  45. git config --global credential.helper "$([ "$(uname -s)" = "Darwin" ] && echo "osxkeychain" || echo "cache --timeout=3600")"
  46. )
  47. which git-alias >/dev/null || brew install git-extras
  48. [ "$(git alias)" ] || (
  49. git alias br branch
  50. git alias ci commit
  51. git alias co checkout
  52. git alias di diff
  53. git alias st status
  54. )
  55. }
  56. _install_dev_js() {
  57. _install_homebrew
  58. which node >/dev/null || brew install node
  59. PKG=jshint; which "$PKG" >/dev/null || npm install -g "$PKG"
  60. PKG=js-beautify; which "$PKG" >/dev/null || npm install -g "$PKG"
  61. PKG=json; which "$PKG" >/dev/null || npm install -g "$PKG"
  62. PKG=jscs; which "$PKG" >/dev/null || npm install -g "$PKG"
  63. }
  64. _install_dev_sh() {
  65. _install_homebrew
  66. which shellcheck >/dev/null || brew install shellcheck
  67. }
  68. _install_dev_py() {
  69. _install_homebrew
  70. mkdir -p "$PYTHONPATH"
  71. PKG=pylint; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
  72. PKG=pep8; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
  73. }
  74. _install_dev_db() {
  75. _install_homebrew
  76. which mongod >/dev/null || brew install mongodb
  77. which redis >/dev/null || brew install redis
  78. }
  79. _install_dev_go() {
  80. _install_homebrew
  81. which go >/dev/null || brew install go --cross-compile-common
  82. }