Zsh

We’ll install zsh for all the features offered by oh-my-zsh. The installation and usage is really intuitive. We will also create the file env.sh, it is a config file we maintain so as to not pollute the ~/.zshrc too much. env.sh holds aliases, exports, path changes etc. and you can find it at the bottom of this page.

Zsh

Install zsh and zsh-completions using Homebrew:

  1. $ brew install zsh zsh-completions

At this point you can customize your shell by using one of two frameworks Prezto or Oh My Zsh. You should follow one of the two sections below.

Install Prezto

Install prezto on top of zsh to get additional functionality:

  1. $ git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

Next create ~/.zshrc file by running:

  1. setopt EXTENDED_GLOB
  2. for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  3. ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
  4. done

Add modules to Prezto by editing ~/.zpreztorc and adding:

  1. zstyle ':prezto:load' pmodule \
  2. 'environment' \
  3. 'terminal' \
  4. 'editor' \
  5. 'history' \
  6. 'directory' \
  7. 'spectrum' \
  8. 'utility' \
  9. 'completion' \
  10. 'git' \
  11. 'syntax-highlighting' \
  12. 'history-substring-search' \
  13. 'prompt'
  14. zstyle ':prezto:module:prompt' theme 'paradox'

Install Oh My Zsh

Note: You don’t need this section if you installed Prezto.

Install Oh My Zsh on top of zsh to get additional functionality:

  1. $ curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

If you’re still in the default shell, change default shell to zsh manually:

  1. $ chsh -s /usr/local/bin/zsh

Add plugins (they are all optional but recommended) to Oh My Zsh and use theme by editing ~/.zshrc and adding:

  1. ZSH_THEME=pygmalion
  2. plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting)

env.sh

To include env.sh, open ~/.zshrc and add the following:

  1. source ~/<path to file>/env.sh

This file comes with some pre-defined settings, they are all optional. Please review them before you use them as your configuration.

  1. #!/bin/zsh
  2. # PATH
  3. export PATH="/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
  4. export EDITOR='subl -w'
  5. # export PYTHONPATH=$PYTHONPATH
  6. # export MANPATH="/usr/local/man:$MANPATH"
  7. # Virtual Environment
  8. export WORKON_HOME=$HOME/.virtualenvs
  9. export PROJECT_HOME=$HOME/projects
  10. source /usr/local/bin/virtualenvwrapper.sh
  11. # Owner
  12. export USER_NAME="YOUR NAME"
  13. eval "$(rbenv init -)"
  14. # FileSearch
  15. function f() { find . -iname "*$1*" ${@:2} }
  16. function r() { grep "$1" ${@:2} -R . }
  17. #mkdir and cd
  18. function mkcd() { mkdir -p "$@" && cd "$_"; }
  19. # Aliases
  20. alias cppcompile='c++ -std=c++11 -stdlib=libc++'
  21. # Use sublimetext for editing config files
  22. alias zshconfig="subl ~/.zshrc"
  23. alias envconfig="subl ~/projects/config/env.sh"