Use Drush Autocomplete with Zsh

Update: I had the filename as drush.autocomplete.sh, but the filename should now be drush.complete.sh. Brent noticed this. The info below as been updated as such.

Brent Dunn pointed me to drush.complete.sh, which I didn't even know existed. Brent and I both wanted to give this a go in Zsh since we use oh-my-zsh, but drush.autocomplete.sh is setup for bash.

I was able to get drush autocompletes working with Zsh thanks to this stack exchange post

  1. Save drush.complete.sh to your local file system
  2. Add the following to your ~/.zshrc file
    autoload bashcompinit
    bashcompinit
    source /path/to/your/drush.complete.sh
  3. Source the changes: $ source ~/.zshrc

Now you can enjoy drush autocompletions in zsh style! For example, $ drush sql followed by tab will give you a browsable list of all the drush sql related commands.

1.%20zsh

Blog Category: