zsh completion after installing/removing packages

4

1

How does zsh figure out currently installed packages on Debian, and how can I update that information? After running apt-get install, zsh won't autocomplete that package as a possible parameter for apt-get purge or apt-get remove. The only way I can get it to update is to run a new shell. None of the tricks I've found seem to work: rehash or even rm ~/.zcompdump && compinit don't help.

Bash recognizes package installs and removals, and modifies the possible parameter lists for apt-get remove/purge accordingly, without any user interaction. This is using the default configuration on Debian wheezy.

With the default configuration for zsh, I don't get any parameter completion for apt-get at all. I'm using the following custom rc to get completion (with the above caveat):

autoload -U compinit
compinit
eval `dircolors -b`
PS1="%n@%M:%~ > "
zstyle ':completion:*' list-colors $LS_COLORS

Jayssoneer

Posted 2012-04-11T03:09:09.160

Reputation: 41

Answers

0

# auto rehash commands
# http://www.zsh.org/mla/users/2011/msg00531.html
zstyle ':completion:*' rehash true

SmartFinn

Posted 2012-04-11T03:09:09.160

Reputation: 9

1Where do I have to add this line? To .zshrc? – white_gecko – 2015-05-19T08:52:00.437

1No, this does not help. Even with this, or manually calling the rehash command, the package names available for completion are not updated. I've now started using exec zsh, though that's of course not perfect (i.e. because of background jobs). – Rörd – 2013-10-20T13:18:49.660