This tutorial will show you how to set up a real-time, type-ahead autocompletion module for ZSH to make working with the terminal easier and more efficient.
The first method we shall use is the zsh-autocomplete repository, a simple shell script that enables real-time auto-completion and suggestions in your ZSH shell as you type.
Before installing it, ensure you have ZSH and git installed and up to date.
The first step is to clone the repository:
Next, remove any calls to compinit available in the ZSH config file then finally, navigate to the cloned repository and add the .zsh file to .zshrc using the source command:
Once you have successfully installed the tool, you can now see auto-suggestions as you type commands:
The other method is to use the zsh-autosuggestions package. This package allows you to auto-suggest commands based on your commands’ history, allowing you to access commonly used commands with ease.
Using apt package manager, issue the install as:
sudo apt-get install zsh-autosuggestions -y
Once installed, you can start typing commands, and you will get access to the commands you can type in that context.
Using the two mentioned approaches, you can make your tasks in the shell much easier by quickly accessing previously used commands and new ones in real-time.