DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Enmanuel JarquΓ­n
Enmanuel JarquΓ­n

Posted on

Autosuggestions with oh-my-zsh

New Macs already include zsh by default, so what we only need is to run the following command:

Install oh-my-zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

The first step created us the following the /.oh-my-zsh directory

echo $ZSH_CUSTOM
>> /Users/<your home directory>/.oh-my-zsh/custom
Enter fullscreen mode Exit fullscreen mode

Install autosuggestions plugin

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

That command will copy the zsh-autosuggestions repo into /Users/<your home directory>/.oh-my-zsh/custom/plugins

Now we are going to add new plugin by opening the file ~/.zshrc and add the zsh-autosuggestions plugin without commas

plugins=( 
    # other plugins...
    zsh-autosuggestions
)
Enter fullscreen mode Exit fullscreen mode

Restart your terminal and now when you type a command that you used previously you will see that now it will auto suggest you using a gray text.
Image description

Top comments (0)

We want your help! Become a Tag Moderator.
Check out this survey and help us moderate our community by becoming a tag moderator here at DEV.