.profile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. [ -f "$HOME/.bash_profile" ] || ln -sv "$HOME/.profile" "$HOME/.bash_profile"
  41. [ -f "$HOME/.bashrc" ] || ln -sv "$HOME/.profile" "$HOME/.bashrc"
  42. which git-alias >/dev/null || brew install git-extras
  43. [ "$(git alias)" ] || (
  44. git alias br branch
  45. git alias ci commit
  46. git alias co checkout
  47. git alias di diff
  48. git alias st status
  49. )
  50. }
  51. _install_dev_js() {
  52. _install_homebrew
  53. which node >/dev/null || brew install node
  54. PKG=jshint; which "$PKG" >/dev/null || npm install -g "$PKG"
  55. PKG=js-beautify; which "$PKG" >/dev/null || npm install -g "$PKG"
  56. PKG=json; which "$PKG" >/dev/null || npm install -g "$PKG"
  57. }
  58. _install_dev_sh() {
  59. _install_homebrew
  60. which shellcheck >/dev/null || brew install shellcheck
  61. }
  62. _install_dev_py() {
  63. _install_homebrew
  64. PKG=pylint; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
  65. PKG=pep8; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
  66. }
  67. _install_dev_db() {
  68. _install_homebrew
  69. which mongod >/dev/null || brew install mongodb
  70. which redis >/dev/null || brew install redis
  71. }
  72. _install_dev_go() {
  73. _install_homebrew
  74. which go >/dev/null || brew install go --cross-compile-common
  75. }