.profile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. }
  44. _install_dev_js() {
  45. _install_homebrew
  46. which node >/dev/null || brew install node
  47. PKG=jshint; which "$PKG" >/dev/null || npm install -g "$PKG"
  48. PKG=js-beautify; which "$PKG" >/dev/null || npm install -g "$PKG"
  49. PKG=json; which "$PKG" >/dev/null || npm install -g "$PKG"
  50. }
  51. _install_dev_sh() {
  52. _install_homebrew
  53. which shellcheck >/dev/null || brew install shellcheck
  54. }
  55. _install_dev_py() {
  56. _install_homebrew
  57. PKG=pylint; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
  58. PKG=pep8; which "$PKG" >/dev/null || (easy_install -d "$PYTHONPATH" "$PKG" && ln -sv "$PYTHONPATH/$PKG" "$(brew --prefix)/bin/$PKG")
  59. }
  60. _install_dev_db() {
  61. _install_homebrew
  62. which mongod >/dev/null || brew install mongodb
  63. which redis >/dev/null || brew install redis
  64. }
  65. _install_dev_go() {
  66. _install_homebrew
  67. which go >/dev/null || brew install go --cross-compile-common
  68. }