DEV Community

Cover image for Best Terminal Setup | ZSH
Mx Panf
Mx Panf

Posted on

Best Terminal Setup | ZSH

I recently tried new terminal configuration with ZSH shell, Oh-My-Zsh framework and Powerlevel10k theme on Terminator terminal emulator.
So, I want to share it with you.
Go to shell setup part >


What we will setup?

  • Terminator terminal to support splitting the terminal screen vertically and horizontally into multiple windows. Extremely useful when working with distributed systems like blockchain.
  • ZSH a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting with many plugins and themes.
  • Oh-My-Zsh open source, community-driven framework for managing Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins & themes.
  • Powerlevel10k theme for ZSH. It looks better in a bundle with Oh-My-Zsh.

Installation

I do everything on Ubuntu 20.10, but there will be no difference on RHEL or Arch except for package manager.

Install the Terminator

Open terminal with (Ctrl + Alt + T) or find in Apps.



sudo apt install -y terminator


Enter fullscreen mode Exit fullscreen mode

Open it.
Terminator

Install ZSH



sudo apt install -y zsh


Enter fullscreen mode Exit fullscreen mode

To make it your default shell run:
chsh -s $(which zsh) in command line

zsh

Other ways of installation you can find in official GitHub repo

Oh-My-Zsh framework

Install OMZ with shell script, which will setup default themes and plugins.



curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh


Enter fullscreen mode Exit fullscreen mode

PowerLevel10k Theme

Install special font for better display of icons. I recommend MesloLGS NF Regular.ttf. After fonts proceed to theme.

Font install



git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
sudo echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc


Enter fullscreen mode Exit fullscreen mode

If you don't have curl & git => sudo apt install -y curl git

Configure colors, spaces & other features

Rerun ZSH



source ~/.zshrc


Enter fullscreen mode Exit fullscreen mode

and configure it as you wish.

p10k

To reconfigure theme, use p10k configure command.

Default plugins

You can enable IP, battery and other default plugins editing .p10k.zsh file.



nano $HOME/.p10k.zsh


Enter fullscreen mode Exit fullscreen mode

defplugins

External plugins

Syntax-highlighting

For more information visit official repo

Clone plugin to $ZSH_CUSTOM/plugins



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


Enter fullscreen mode Exit fullscreen mode

Then change ~/.zshrc file



nano $HOME/.zshrc


Enter fullscreen mode Exit fullscreen mode

and near to the End of the file find string plugins. Separated by a space add name of plugin name zsh-syntax-highlighting

syntax

Rerun shell with this command: zsh

Autosuggestions

For more information visit official repo

Clone plugin to $ZSH_CUSTOM/plugins



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


Enter fullscreen mode Exit fullscreen mode

Then change ~/.zshrc file



nano $HOME/.zshrc


Enter fullscreen mode Exit fullscreen mode

and near to the End of the file find string plugins. Separated by a space add name of plugin name zsh-autosuggestions

autosug

Rerun shell with this command: zsh

That's all!

After all these actions, you will get something like this:

total

Give some feedback and share screenshots of your terminal themes!


I was inspired by these articles:


Top comments (1)

Collapse
 
romkatv profile image
Roman Perepelitsa

I recommend MesloLGS NF Regular.ttf.

If you install only the regular font, bold and italic text in the terminal won't look very nice. It's a good idea to install all four ttf files as described in github.com/romkatv/powerlevel10k#m....