Oh My Zsh

Thought I’d give this a go.

From https://ohmyz.sh/

  1. install zsh (on the Mac this is already installed)
  2. set iTerm2 (https://www.iterm2.com/downloads.html) to use this (chsh -s $(which zsh) and in iTerm2 > Preferences > Profiles > Default > General, set the Command to /bin/zsh instead of Login shell. Note – you can also do this via System Preferences: https://stackoverflow.com/a/44547726/343204
  3. Install Oh My Zsh. i.e. sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" –  https://ohmyz.sh/
  4.  If you’re using the agnoster theme, then be aware you’ll need to use Patched fonts (not a big thing but just make sure you install both ASCII and non-ASCII fonts)  – https://github.com/powerline/fonts. i.e. `git clone https://github.com/powerline/fonts.git; cd fonts; ./install.sh` and select them as the default fonts in iTerm2 > Preferences > Profiles > Text (change both Font and Non-ASCII Font to 12pt Meslo LG S Regular for Powerline)
  5. The most time-consuming stuff was customisation. Copy chosen theme to ~/.oh-my-zsh/custom/themes/agnoster.zsh-theme and customise. i.e. `cp ~/.oh-my-zsh/themes/agnoster.zsh-theme ~/.oh-my-zsh/custom/themes/` and set as active in ~/.zshrc (i.e. ZSH_THEME=”agnoster”)
  6. Set aliases and autojump. E.g. I have:

# Aliases
alias c=”clear”
alias l=”ls”
alias sfs=”php bin/console server:run”
alias hr=”printf ‘%*s\n’ \”${COLUMNS:-$(tput cols)}\” ” | tr ‘ ‘ -”
alias h=”history”
alias tf=”terraform”

[[ -s $(brew –prefix)/etc/profile.d/autojump.sh ]] && . $(brew –prefix)/etc/profile.d/autojump.sh


Customisation Notes:


# Dir: current working directory
prompt_dir() {
prompt_segment blue black " `basename ${PWD/#$HOME/'~'}` "


prompt_segment blue black '%c'


E.g. no user@host in command prompt:



in your zshrc file.



See also



And on the agnoster theme:

  1. red cross means last command had a non-zero exit code: https://github.com/agnoster/agnoster-zsh-theme/issues/54

And a Zsh Cheat Sheet:



My favourite git shortcuts / aliases as:

gst: git status

ga: git add

gcam: git commit -m

gp: git push

gpsup:git push –set-upstream origin $(current_branch)

gd : git diff

gb : git branch

glg: git log –stat –max-count = 10

Full details: https://github.com/robbyrussell/oh-my-zsh/wiki/Cheatsheet


Leave a Reply

Your email address will not be published. Required fields are marked *