Simple yet awesome zsh+ oh-my-zsh development environment setup

Aviral Agrawal
2 min readApr 6, 2020

Having an efficient and powerful development environment setup is important to boost the productivity and bring out the best while writing code, debugging, building etc so that we can focus more on creating something valuable and less on just trying to make things work. In this article as well as more to follow, we will see how a basic shell setup can help us in that direction. I have done these steps on Ubuntu WSL in Windows 10. For native ubuntu setup, you just need to see how to setup powerline font for ubuntu(prerequisite), rest all the steps will be same.

Prerequisite

Download and install powerline fonts for windows using this tutorial https://medium.com/@slmeng/how-to-install-powerline-fonts-in-windows-b2eedecace58

After installing powerline fonts, start your favorite terminal(WSL, putty, moba Xterm, etc ) with font set as any one of the powerline fonts( like droid sans mono Powerline or DejaVu Sans Powerline)

TLDR

For quick setup, just execute the below commands 1 by 1 in the ubuntu shell to setup zsh and oh-my-zsh. In future articles, we will build tmux, vim (and possibly other tools) on top of this add power to this setup.

zsh and oh-my-zsh setup steps

Setting up zsh and oh-my-zsh

Clone the repo which contains theme for zsh

git clone https://github.com/aviralwal/newserversetup.git
cd newserversetup

zsh is a powerful shell alternate to bash or sh and can be used in combination with oh-my-zsh framework to boost the operability in shell. We will install zsh using the following commands

sudo apt update
sudo apt install -y zsh

Since this will not change the default shell, we will run the command chsh(change shell) to change the default shell to zsh as well as create a sample .zshrc file so that we do not get a warning of first time usage when using zsh

sudo chsh -s $(which zsh) $(whoami)
touch ~/.zshrc
echo "#hello" > ~/.zshrc

This completes our basic zsh setup. To use it, either logout of the user and login to use it or type zsh to use it. After this, we will download oh-my-zsh, download some useful plugins for it like syntax highlighting and auto suggestions and add support for 256 bit color to shell

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" #select option 'y'git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestionsgit clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightingsed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/g' ~/.zshrcecho ‘export TERM=”xterm-256color”’ >> ~/.zshrc
source ~/.zshrc

Deafult oh-my-zsh theme(robbyrussell) is good, but i prefer a theme called bullet-train . You can either use default one or setup bullet-train. To set it up bullet-train, run the following commands

cp bullet-train.zsh-theme ~/.oh-my-zsh/themessed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="bullet-train"/g' ~/.zshrcsource ~/.zshrc

This completes our setup for zsh as well as oh-my-zsh. After this we will proceed with setting up tmux as well as vim in the next articles to make our awesome setup even more powerful. Hope I was able to help you with this info.

--

--