Friday, July 6, 2018

Installing Z Shell and customize shell prompts using Oh My Zsh

# Install zsh
brew install zsh zsh-completion

# Install Oh My Zsh
# Copy Oh My zsh (clone from repo)
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# Create zsh config file from template
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
# Change default shell to zsh
chsh -s /bin/zsh

vi .zshrc
#enable plugins (optional example)
plugins=(
  cp
  git
  golang
  helm
  kubectl
  minikube
  osx
  perl
  pip
  postgres
  ssh-agent
  sudo
  svn
  terminalapp
  terraform
  vagrant
  xcode
)

# Enable Kubernetes prompt (optional)
brew install kube-ps1

# Edit zsh config
vi .zshrc
# User configuration
source "/usr/local/opt/kube-ps1/share/kube-ps1.sh"
PS1='$(kube_ps1)'$PS1