How To Install zsh-syntax-highlighting on Ubuntu 20.04

In this tutorial we learn how to install zsh-syntax-highlighting on Ubuntu 20.04. zsh-syntax-highlighting is Fish shell like syntax highlighting for zsh

Introduction

In this tutorial we learn how to install zsh-syntax-highlighting on Ubuntu 20.04.

What is zsh-syntax-highlighting

zsh-syntax-highlighting is:

This package provides syntax highlighting for the shell zsh. It enables highlighting of commands whilst they are typed at a zsh prompt into an interactive terminal. This helps in reviewing commands before running them, particularly in catching syntax errors.

This feature is inspired by the Fish shell, which provides it by default.

There are numerous ways to configure the colors used for highlighting, and to configure what is highlighted.

There are three methods to install zsh-syntax-highlighting on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install zsh-syntax-highlighting Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install zsh-syntax-highlighting using apt-get by running the following command:

sudo apt-get -y install zsh-syntax-highlighting

Install zsh-syntax-highlighting Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install zsh-syntax-highlighting using apt by running the following command:

sudo apt -y install zsh-syntax-highlighting

Install zsh-syntax-highlighting Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install zsh-syntax-highlighting using aptitude by running the following command:

sudo aptitude -y install zsh-syntax-highlighting

How To Uninstall zsh-syntax-highlighting on Ubuntu 20.04

To uninstall only the zsh-syntax-highlighting package we can use the following command:

sudo apt-get remove zsh-syntax-highlighting

Uninstall zsh-syntax-highlighting And Its Dependencies

To uninstall zsh-syntax-highlighting and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove zsh-syntax-highlighting

Remove zsh-syntax-highlighting Configurations and Data

To remove zsh-syntax-highlighting configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge zsh-syntax-highlighting

Remove zsh-syntax-highlighting configuration, data, and all of its dependencies

We can use the following command to remove zsh-syntax-highlighting configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge zsh-syntax-highlighting

References

Summary

In this tutorial we learn how to install zsh-syntax-highlighting package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.