[zsh, ohmyzsh] Setting ZSH with Oh-My-Zsh on my terminal

1 minute read

0. What is ZSH

0. What is oh-my-zsh

1. Installing ZSH

Default

// install zsh
$ sudo apt install zsh

// verify installation zsh
$ zsh --version

// confirm your authorized shells list
$ chsh -l
or
$ cat /etc/shells

// Make it your default shell
$ chsh -s $(which zsh)
or
$ chsh username -s $(which zsh)

// verify default shells
$ echo $SHELL
$ $SHELL --version

MacOS

$ brew install zsh

Since macOS 10.15 Catalina, the default shell has been changed to zsh

Centos/RHEL

$ sudo yum update && sudo yum -y install zsh

2. Installing oh-my-zsh

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

ohmyzsh

  • you can change themes, plugins and the other options in .zshrc
$ vi ~/.zshrc

3. Themes

$ vi ~/.zshrc
  • Robby’s theme is the default one.
ZSH_THEME="robbyrussell"
  • To use a different theme, simply change the value to match the name of your desired theme
ZSH_THEME="agnoster"

ohmyzsh-agnoster

Note: many themes require installing the Powerline Fonts or Naver D2Coding Font in order to render properly.

4. Plugins

$ vi ~/.zshrc
plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
)

Installing zsh-syntax-highlighting

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Installing zsh-autosuggestions

$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Leave a comment