Gary's Blog

Terminal autocomplete (only macOS and Linux)

How to Make your terminal smarter?

1 Install Oh My ZSH!

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

2 Install zsh-autosuggestions and zsh-autocomplete:

brew install zsh-autosuggestions zsh-completions

Add following to ~/.zshrc:

source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
if type brew &>/dev/null; then
  FPATH=$(brew --prefix)/share/zsh-completions:$FPATH

  autoload -Uz compinit
  compinit
fi

3 Force rebuild zcompdump:

rm -f ~/.zcompdump; compinit
chmod go-w '/opt/homebrew/share'
chmod -R go-w '/opt/homebrew/share/zsh'
  1. Install fzf
    brew install fzf
    $(brew --prefix)/opt/fzf/install

    Reopen the terminal, it will works.

Exit mobile version