Install and Use Zsh Autosuggestions Plugin: 3 Easy Steps
This guide is designed to teach you how to Install and Use Zsh Autosuggestions Plugin on Linux. Zsh, also known as the Z shell, is a powerful shell environment available on Linux and Unix-based systems. Its robust plugin support allows for extensive customization, making it a preferred choice over other shell tools. Thanks to its optimized features, Zsh provides a fast and efficient shell experience.
The Oh My Zsh framework further enhances Zsh by enabling the installation of various plugins and themes. Among these, the Zsh Autosuggestions plugin stands out as a particularly valuable tool. It intelligently suggests commands based on your command history and the commands you are currently typing.
In this guide, brought to you by Orcacore, we will demonstrate how to easily Install and Use Zsh Autosuggestions Plugin. Let’s dive in!
Prerequisites
Before you begin with the Zsh autosuggestions plugin installation, ensure that you have the necessary prerequisites in place. This includes having both Zsh and the Oh My Zsh framework installed on your Linux server. If you haven’t already, you can follow this guide on Install Zsh and Oh My Zsh on Linux from the Command Line to get set up.
Once you have Zsh and Oh My Zsh installed, proceed with the following steps to Install and Use Zsh Autosuggestions Plugin.
Step 1 – Download the Autosuggestions Plugin via GitHub
To install the autosuggestions plugin, clone it from the Oh My Zsh Git repository.
Assuming you have already installed and configured Oh My Zsh, run the following command to clone the zsh-autosuggestions
plugin:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

This command downloads the autosuggestions repository and places it within the plugins directory of your Oh My Zsh installation.
Step 2 – Enable the Zsh-Autosuggestions Plugin
Now that the plugin is downloaded, you need to enable it by adding it to your ~/.zshrc
file. Open the file using your preferred text editor. In this example, we’ll use the Vi editor:
vi ~/.zshrc
Locate the "plugins" section within the file. It should resemble the following:

Add zsh-autosuggestions
to the plugins list, like this:
plugins=(git)
plugins=(
zsh-autosuggestions
)
source $ZSH/oh-my-zsh.sh
Your file should now look similar to this:

Save the file and close the editor. The autosuggestions plugin is now installed and enabled.
Step 3 – Using the Zsh Autosuggestions Plugin
To activate the plugin, close your current terminal session and open a new one. The plugin will now be active and ready to use.
Using the plugin is straightforward. As you type commands in the terminal, the plugin will display a suggestion for the complete command based on your history. To accept the suggestion, press the right-arrow key. To ignore the suggestion and continue typing, press the down-arrow key or simply continue typing.
That’s all there is to it! You have successfully learned how to Install and Use Zsh Autosuggestions Plugin.
Conclusion
You’ve now learned how to Install and Use Zsh Autosuggestions Plugin and enable it within your Zsh terminal. The plugin is incredibly user-friendly, allowing you to accept or ignore suggestions with simple key presses.
Enjoy the enhanced productivity! You might also be interested in these related articles:
Install build-essential on Ubuntu 22.04
Create a Local Repository on AlmaLinux 9
Install Java with Apt on Debian 12 Bookworm
Alternative Solutions for Zsh Autosuggestions
While the above method using Oh My Zsh is very popular and widely used, there are alternative approaches to achieving command autosuggestions in Zsh. Here are two different ways:
1. Using a Zsh Plugin Manager (zplug)
Zplug is another popular Zsh plugin manager that offers a more minimalist approach compared to Oh My Zsh. It focuses solely on plugin management and doesn’t include themes or other features. Using zplug to install zsh-autosuggestions
can be a good option if you prefer a lighter-weight solution.
Installation and Configuration of zplug:
First, install zplug:
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/install.sh | zsh
Next, add the following to your ~/.zshrc
file to configure zplug:
source ~/.zplug/init.zsh
zplug "zsh-users/zsh-autosuggestions", as:plugin
# Install plugins if not installed yet
if ! zplug check; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# Load plugins
zplug load
After saving the ~/.zshrc
file, restart your terminal or source the file:
source ~/.zshrc
This configuration will install and load the zsh-autosuggestions
plugin using zplug. The plugin will then function as described in the original article, providing command suggestions based on your history.
Advantages of using zplug:
- Lightweight: zplug is a leaner plugin manager compared to Oh My Zsh.
- Focused: zplug is focused solely on plugin management.
- Customizable: It offers fine-grained control over plugin loading and management.
2. Manual Installation and Configuration
For users who prefer complete control over their shell environment, manual installation and configuration of zsh-autosuggestions
is an option. This involves directly managing the plugin files and configurations without relying on a plugin manager.
Steps for Manual Installation:
-
Clone the repository:
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
-
Add the plugin’s source to your
~/.zshrc
file:source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
Add this line to the end of your
~/.zshrc
file. -
Customize the plugin (Optional):
You can further customize the plugin’s behavior by setting environment variables in your
~/.zshrc
file before sourcing the plugin. For example, to change the suggestion color, you could add:ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=237' source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
-
Restart your terminal or source the
~/.zshrc
file:source ~/.zshrc
This manual approach requires a bit more technical knowledge but provides the greatest flexibility and control. You are responsible for updating the plugin manually and managing any potential conflicts.
Advantages of Manual Installation:
- Full Control: You have complete control over the plugin’s installation and configuration.
- No Dependencies: You don’t rely on any plugin manager.
- Customization: You can easily customize the plugin’s behavior by modifying its source code.
By exploring these alternative solutions, you can choose the method that best suits your needs and preferences for Install and Use Zsh Autosuggestions Plugin.