Lean ZSH terminal
Tags: lean, zsh, ohmyzsh, raspberrypi
Published: 2020-02-22 12:50:34

*This post was originally published at [thbe.org](https://www.thbe.org/posts/2020/01/02/Lean_zsh_terminal.html).*

In the past two terminal posts ([**Enhance your macOS terminal**](https://dev.to/thbe/enhance-your-macos-terminal-25o7) and [**Enhance your macOS terminal - p10k**](https://dev.to/thbe/enhance-your-macos-terminal-p10k-1g3m)) I showed how a fully-fledged terminal can look like. In this post, I'll concentrate on a lean terminal I'll for example use on my Raspberry PI boxes. This is how it should look like in the end:

![Customized lean Terminal with oh-my-zsh](https://dev-to-uploads.s3.amazonaws.com/i/r5snk3i5p45t1yjjk5ow.png)

My Raspberry PIs are normally equipped with [**Raspbian**](https://www.raspberrypi.org/downloads/raspbian/) in the minimal version. The standard shell on Debian is normally the *bash* shell, so we need to change it to ZSH first:

```shell
$ sudo apt-get clean all
$ sudo apt-get update
$ sudo apt-get -y install zsh zsh-autosuggestions zsh-syntax-highlighting
$ chsh -s $(which zsh)
$ grep $USER /etc/passwd
```

The last command should end with something like *:/usr/bin/zsh* indicating that ZSH is now the primary shell of the account. As I'm looking for a lean configuration I will only install [**oh-my-zsh**](https://github.com/ohmyzsh/ohmyzsh) and a third party theme.

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

Finally, the third party theme needs to be installed. I used typewritten by [**reobin**](https://github.com/reobin/typewritten) for this:

```shell
git clone https://github.com/reobin/typewritten.git $ZSH_CUSTOM/themes/typewritten
```

Once everything is installed and in place, the components need to be configured. This is done primarily through the *.zshrc* configuration file. Here is the one that creates the configuration from the screenshot above:

```bash
# zsh configuration file
#
# Author: Thomas Bendler <code@thbe.org>
# Date:   Thu Jan  2 17:53:48 GMT 2020

# Add local sbin to $PATH.
export PATH="/usr/local/sbin:${PATH}"

# Path to the oh-my-zsh installation.
export ZSH="${HOME}/.oh-my-zsh"

# Use case-sensitive completion.
CASE_SENSITIVE="true"

# Define how often to auto-update (in days).
export UPDATE_ZSH_DAYS=7

# Enable command auto-correction.
ENABLE_CORRECTION="true"

# Display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"

# Configure history stamp format
HIST_STAMPS="yyyy-mm-dd"

# Plugin configuration
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  ansible
  bundler
  colored-man-pages
  colorize
  common-aliases
  debian
  git
  nmap
  zsh-navigation-tools
  zsh_reload
)

# Use typewritten theme with multiline enabled
TYPEWRITTEN_MULTILINE=true
ZSH_THEME="typewritten/typewritten"

# Load zsh extensions
[ -e /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ] && source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
[ -e /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] && source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# Load oh-my-zsh framework
[ -e ${HOME}/.oh-my-zsh/oh-my-zsh.sh ] && source ${HOME}/.oh-my-zsh/oh-my-zsh.sh
```