Skip to content

Instantly share code, notes, and snippets.

@jmrashed
Last active October 7, 2024 10:51
Show Gist options
  • Select an option

  • Save jmrashed/9ea830be203b755406776d1fbe77a4cf to your computer and use it in GitHub Desktop.

Select an option

Save jmrashed/9ea830be203b755406776d1fbe77a4cf to your computer and use it in GitHub Desktop.
Installing Oh My Zsh with Command Auto-Suggestions on Ubuntu 20.04

Installing Oh My Zsh with Command Auto-Suggestions on Ubuntu 20.04

Follow these steps to install Oh My Zsh with auto-suggestions and syntax highlighting on Ubuntu 20.04.

Step 1: Update Package Lists

Before starting, update your package lists:

sudo apt update

Step 2: Install Zsh

Install Zsh (if not already installed):

sudo apt install zsh -y

Verify the installation:

zsh --version

Step 3: Set Zsh as Default Shell

Change the default shell to Zsh:

chsh -s $(which zsh)

Log out and log back in, or start Zsh immediately by running:

zsh

Step 4: Install Oh My Zsh

Run 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.

Step 5: Install Zsh Auto-Suggestions Plugin

To enable automatic command suggestions, follow these steps:

  1. Clone the zsh-autosuggestions repository:

    git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
  2. Edit your .zshrc file:

    nano ~/.zshrc
  3. Add zsh-autosuggestions to your plugins list:

    plugins=(git zsh-autosuggestions)
  4. Save and exit (press CTRL + X, then Y, and Enter).

  5. Apply changes:

    source ~/.zshrc

Step 6 (Optional): Install Zsh Syntax Highlighting Plugin

To highlight command syntax, follow these steps:

  1. 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
  2. Edit your .zshrc file again:

    nano ~/.zshrc
  3. Add zsh-syntax-highlighting to your plugins list:

    plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
  4. Save and apply changes:

    source ~/.zshrc

Step 7: Restart Terminal

After completing these steps, restart your terminal to enjoy auto-suggestions and syntax highlighting in Zsh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment