yet.org

Oh My Zsh!

It’s for sure not the first or the last cooking article about Oh My Zsh!, but if you don’t know it, just try it, you’ll understand why so much people are blogging about it. So let’s start by the official description. It’s a community-driven framework initiated by Robby Russel for managing your zsh configuration. It includes 40+ optional plugins (rails, git,OSX, hub, capistrano, brew, ant, macports, etc), over 80 terminal themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community. Looks great isn’t it ? So let’s digging it !

Installation

  1. If you trust Robby Russell Just type:

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

  2. Or look around you’ll find other ways. At the end of it, you should see:

  3. It’s a good idea to switch over your .bash_profile stuff in your newly created .zshrc

  4. If you use RVM, add the following lines at the end of you ~/.zshrc

    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Plugins

~/.oh-my-zsh/plugins/ plugins storage location
~/.oh-my-zsh/custom/plugins/ your plugins
~/.zshrc edit it to enable them
plugins=(git) by default
plugins=(git github bundler) the ones I’m currently using
_PLUGIN indicates plugins that adds some autocompletion features.

Themes

~/.oh-my-zsh/themes/ themes storage location, look at some screenshots.
ZSH_THEME variable used to store theme configuration in your ~/.zshrc
ZSH_THEME="robbyrussell" by default
ZSH_THEME="agnoster" the one I use

agnoster require some patched fonts, like patched Menlo 14pt, download and install them into /usr/share/fonts on Linux.
DEFAULT_USER can be setup for agnoster not to display your regular username when logged in as yourself on local machine.

Colors

You can now apply Solarized palette to your dircolors and terminal. Refer to my Elementary article for details on how to apply it to gnome-terminal. For iTerm2 on Mac OS X, just use the Profile preference menu.

Uninstall

% uninstall_oh_my_zsh if you don’t like it, this command revert back to your previous setup.

Customization

.oh-my-zsh/custom add files ending with .zsh here to customize Oh My Zsh!
.oh-my-zsh/custom/plugins for new plugins.

Zsh tips & tricks

As you’ll dicover during your journey into this new world, among other things Zsh shares history among sessions. But as you can see below there is a lot more to it:

command meaning
cd <TAB> <TAB> Directory completion
ls -<TAB>
git commit -<TAB>
Argument completion
ls yet/**/.haml Deep search/globbing
ls <UP> Filter out your history
<Filename Pagination filename
..
...
-
Moving to the corresponding dir

Advanced idea

Forking Oh My Zsh is a great idea to keep a customized repository ready for consumption by all your nodes.
Update the following files in your repository to make your own:

~/.oh-my-zsh/tools/install.sh update repository url with your own
~/.oh-my-zsh/README.textile update repository url with your own
~/.oh-my-zsh/templates/zshrc.zsh-template update to reflect your preferences, used to generate ~/.zshrc at install time.
~/.oh-my-zsh/custom put whatever customization there to avoid poluting anything else in the repository.

Now to install from your own repo just type for example:

wget --no-check-certificate https://github.com/planetrobbie/oh-my-zsh/raw/master/tools/install.sh -O - | sh