DEV Community

0xkoji
0xkoji

Posted on

Install zsh-autocomplete on WSL2

What is zsh-autocomplete?

Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.

GitHub logo marlonrichert / zsh-autocomplete

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.

Autocomplete for Zsh

This plugin for Zsh adds real-time type-ahead autocompletion to your command line, similar to what you find desktop apps. While you type on the command line, available completions are listed automatically; no need to press any keyboard shortcuts. Press Tab to insert the top completion or to select a different one.

Additional features:

  • Out-of-the-box configuration of Zsh's completion system
  • Multi-line history search
  • Completion of recent directories
  • Useful keyboard shortcuts
  • Easy to configure

Enjoy using this software? Become a sponsor! 💝

Requirements

Recommended:

  • Tested to work with Zsh 5.8 and newer.

Minimum:

  • Should theoretically work with Zsh 5.4, but I'm unable to test that.

Installation & setup

First, install Autocomplete itself. Here are some way to do so:

  • To use only releases (instead of the main branch), install zsh-autocomplete with a package manager. As of this writing, this package is available through Homebrew, Nix, pacman, Plumage…

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

Add the following to .zshrc

plugins=( 
    git
    zsh-autosuggestions
)
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
moopet profile image
Ben Sinclair

ZSH_CUSTOM isn't set by default and the command you've supplied expects either that variable to be populated or oh-my-zsh to be installed, and I believe plugins is an oh-my-zsh thing as well.

If you want to use this autocomplete, you can source it directly from your .zshrc file, from wherever you checked it out to.

It's not specific to WSL, rather to any system running zsh. WSL can run other distros which don't use zsh as their default shell.