> ## Content Index
> Fetch the complete content index at: https://linuxhandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Enabling Auto Suggestion in Zsh
- URL: https://linuxhandbook.com/zsh-auto-suggestion/
- Published: 2024-02-19T11:09:35.000Z
- Updated: 2024-02-19T11:09:35.000Z
- Description: Get command completion suggestions based on your command history.
- Author: Sagar Sharma
- Tags: Using Zsh, #docs-col, #group-essential-feature

By default, zsh can do the bash styled tab completion. However, you can take it to the next level by using the zsh-autosuggestions plugin. It will suggest commands based on the [Zsh command history](https://linuxhandbook.com/zsh-command-history/) and you can autocomplete the suggestion by pressing the `Tab` key.

The final result looks like this:

![](https://linuxhandbook.com/content/images/2024/02/using-auto-complete-and-auto-suggestions-in-zsh.gif)

Before you proceed to the how-to part, make sure you have installed Git in your system, and if not, here's [how to install Git on Ubuntu](https://learnubuntu.com/install-git/?ref=linuxhandbook.com):

```
sudo apt install git
```

In this tutorial, I will walk you through two ways you can enable auto-suggestion for tab completion in zsh:

- For Oh My Zsh users
- Manual installation

So let's start with the first one.

## Method 1: For Oh My Zsh users 

If you are already using Oh My Zsh, then enabling this feature is quite easy and can be done in two easy steps.

First, use the following command to download the [auto-suggestions plugin](https://github.com/zsh-users/zsh-autosuggestions?ref=linuxhandbook.com) from GitHub:

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

Now, open the zshrc file using the following command:

```
nano ~/.zshrc
```

In this config file, you'd have to find a line starting with `plugins` and add `zsh-autosuggestions` as shown here:

![](https://linuxhandbook.com/content/images/2024/02/enable-auto-suggestions-for-tab-complition-for-oh-my-zsh-users.webp)

Finally, [save changes and exit from the configuration file](https://linuxhandbook.com/nano-save-exit/). 

To take effect from the changes you've made, source the file using the following command:

```
source ~/.zshrc
```

That's it!

## Method 2: Manual installation of zsh-autosuggestions

If you don't like to rely on Oh My Zsh to customize your zsh, then you can enable autosuggestion using manual installation.

For this, first, use the following command to clone the autosuggestion repo for the manual installation:

```
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
```

Once done, open the zshrc file:

```
nano ~/.zshrc
```

[Go to the end of the file in the nano](https://linuxhandbook.com/beginning-end-file-nano/) editor by pressing `Alt + /` and paste the following lines:

```
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
```

![enable auto suggestion manually in zsh](https://linuxhandbook.com/content/images/2024/02/enable-auto-suggestion-manually-in-zsh.png)

Finally, save changes and exit from the nano editor.

Source the zshrc file to enable the auto-suggestions right now:

```
source ~/.zshrc
```

That's all it takes to enable auto suggestions in zsh manually.

We are on a road of solving problems that every beginner zsh faces, so if you have any topic suggestion, feel free to drop a comment.