Zsh apt list options completion

autocompletezsh

I'm used to using tab completion in bash to get apt list --upgradable by typing apt ltab--utab, but I can't do the same thing with zsh: --u doesn't expand to --upgradable when I press tab.

I googled up some solutions suggesting installing zsh-completions and adding setopt completealiases to ./zshrc, but neither of these helped.

Is there any way to make it work like it did in bash?

Best Answer

It's an old question but since this has bugged me as well I took a look. I couldn't make heads of tails out of the zsh completion stuff for apt and trying to use the bash completion in zsh via bashcompinit failed also.

However, I'm happy to report that this has been fixed as of version 5.8 of zsh which was released in early 2020. That version of zsh is bundled with Ubuntu 20.04 LTS and will be in the soon to be released Debian 11.

The commit is actually here: zsh commit 44614: apt list option completion