Follow these steps to install Oh My Zsh with auto-suggestions and syntax highlighting on Ubuntu 20.04.
Before starting, update your package lists:
sudo apt updateInstall Zsh (if not already installed):
sudo apt install zsh -yVerify the installation:
zsh --versionChange the default shell to Zsh:
chsh -s $(which zsh)Log out and log back in, or start Zsh immediately by running:
zshRun the installation script for Oh My Zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"You may be asked whether you want to change your default shell to Zsh during the installation. Type Y if prompted.
To enable automatic command suggestions, follow these steps:
-
Clone the zsh-autosuggestions repository:
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions -
Edit your
.zshrcfile:nano ~/.zshrc -
Add
zsh-autosuggestionsto your plugins list:plugins=(git zsh-autosuggestions)
-
Save and exit (press
CTRL + X, thenY, andEnter). -
Apply changes:
source ~/.zshrc
To highlight command syntax, follow these steps:
-
Clone the zsh-syntax-highlighting repository:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting -
Edit your
.zshrcfile again:nano ~/.zshrc -
Add
zsh-syntax-highlightingto your plugins list:plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
-
Save and apply changes:
source ~/.zshrc
After completing these steps, restart your terminal to enjoy auto-suggestions and syntax highlighting in Zsh.