Zsh - install git plugin and theme
Published: 2021-11-18 16:31:43




 
| ![display GIT information in terminal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3yp3ttcu1253xer27hpj.png)|
|:--:|
| <h2 style="color:blue;text-align:center;">Want your terminal to display information about GIT? If the answer is `YES`, let's get to it.</h2>|



#Check if Zsh is installed

Every new Mac uses the Z shell (Zsh) by default, but if it is not available to your system install it using Homebrew.

```bash
echo $SHELL
```
Expected result of the `echo $SHELL` command : `/bin/zsh`

**Install zsh using Homebrew(if it is not installed):**

```bash
brew install zsh

# Set zsh as your default shell
chsh -s $(which zsh)
```


#Install Oh My Zsh
Open terminal, run the command

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

#Modify your Oh My Zsh settings
The configuration file for zsh is called .zshrc and lives in your home folder (~/.zshrc).

locate that file and open it
```bash
open ~/.zshrc
```

#Modify your Plugins
Add plugins to your shell by adding the name of the plugin to the plugin array in the `~/.zshrc` file. Separate the names of plugins with a space

```bash
plugins=(git)
```

#Change your Theme

Changing theme is as simple as changing a string in your configuration file. The default theme is `robbyrussell`. Just change that value to the change theme, and don't forget to .

```bash
ZSH_THEME=pygmalion
```

#Apply your changes
To apply the changes you have made to the theme or plugins you need to either 
1. start a new shell instance 

2. reload the configuration for the current shell

```bash
#reload configuration
source ~/.zshrc
```

#Install fonts:

**You must select a font in the Terminal Preferences, under Profiles, for your zsh theme to display properly** 


Most Zsh themes use the powerline fonts, so let's install them. 

** Install powerline fonts **

```bash
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
```
###Change Font in the Mac OS X Terminal

| ![Image of Terminal without font](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4eqlivt9muiflwu7wgh.png) |
|:--:|
| <b>Image of Terminal without font</b>|

- Open Terminal, then navigate to Terminal Preferences > Profiles > Font , then click the `Change` button.

- Select `Ubuntu Mono derivative Powerline` and set the font size to your liking.
- Close preferences, and quit Terminal.

| ![Image of Terminal with font](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/96as74ujzecr9465ir4a.png) |
|:--:|
| <b>Expected Result: Image of Terminal with font</b>|
 

###Change Font for Terminal in Visual Studio Code?
| ![Image of Terminal in Visual Studio Code without font](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x3vqweby6vmy06laq8wu.png)|
|:--:|
| <b>Image of Terminal in Visual Studio Code without font</b>|

**Open settings.json in VSCode**

Press `command + shift + p` in your VSCode window. Then, search for `settings.json` and open it.
![Command Palette-settings.json](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r76donoaszlms7kdd5d5.png)

Add this line to the `settings.json` :
```javascript
{
  "terminal.integrated.defaultProfile.osx": "zsh",
  "terminal.integrated.fontFamily": "Ubuntu Mono derivative Powerline",
  "terminal.integrated.fontSize": 12
}
```
![settings.json code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w5bema0kx7xumojqlq1j.png)
 
 
| ![Image of Terminal in Visual Studio Code with font](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3yp3ttcu1253xer27hpj.png)|
|:--:|
| <b>Image of Terminal in Visual Studio Code with font</b>|