zsh- a shell for humans
@juandebravo
First goal: this prompt
• Is it a new shell? No… it’s been there since 1990!
• It’s newer than bash? Well… less than a year (bash was born in 1989)!
• why has it become popular? Due to oh-my-zsh
How to install
# Debian/Ubuntu!
> sudo apt-get install zsh!
# Mac OS X!
> brew info zsh!
> brew install --disable-etcdir zsh
Set as default shell
> chsh -s $(which zsh)
Nice autocompletion: cd
Nice autocompletion: git
Nice autocompletion: ssh
Globbing> mkdir connect{“-api”,"-backend","-commons"}!
> ls -l **/foo.java!
> ls **/*.py(.x)!
> ls -l */**(Lk+100)!
> vi **/README.md!
path expansion
path replacement
Spelling correction
Aliases
# Normal alias!
> alias ..=“cd ..”!
Aliases
# Global alias!
> alias -g gp=“| grep -i | grep -v grep”!
> ps -ef gp redis!
=> ps -ef | grep -i redis | grep -v grep!
Aliases
# Suffix alias!
> alias -s md=“subl”!
> README.md!
=> subl README.md!
Prompt
PROMPT='$(machine_name) [%~]$(rvm_prompt_info)$(nvm_prompt_info)$(python_prompt_info)$(hg_prompt_info)$(git_prompt_info)%{$reset_color%}!
%{$fg[red]%}$(prompt_char) %{$reset_color%}'
python_prompt_info() {!
[ $VIRTUAL_ENV ] && echo " %{$fg[yellow]%}~`basename $VIRTUAL_ENV`%{$reset_color%}”!
}
Prompt
python_prompt_info() {!
[ $VIRTUAL_ENV ] && echo " %{$fg[yellow]%}~`basename $VIRTUAL_ENV`%{$reset_color%}”!
}
Right Prompt
RPROMPT='$(battery_charge) $(current_time)'
Libraries on top of zsh
> oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh!
> Prezto: https://github.com/sorin-ionescu/prezto!
More cool stuffhttp://fishshell.com/
Thanks!
Juan de Bravo!
@juandebravo!
DEVCON 2013