You are not logged in.

#1 2008-03-15 16:26:28

BC
Member
Registered: 2008-01-29
Posts: 83

Zsh completion

I recently switched to zsh and found an issue with tab completion.  If I install a package that has a command (e.g. /usr/bin/xyz), zsh won't have completions for it until I "show" zsh the command actually exists with a "which xyz".  I know bash doesn't have this problem.  So far, here's the solution I've found:

 zstyle ':completion:*' command-path ~/bin /bin /usr/bin /sbin /usr/sbin /opt/java/jre/bin /opt/mozilla/bin

To me, this seems like an ugly solution since I'd have to maintain the path list.  Is there a better way?

Offline

#2 2008-03-15 16:38:30

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Zsh completion

I just use rehash after installing a new program if I need to complete it.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#3 2008-03-15 19:01:34

BC
Member
Registered: 2008-01-29
Posts: 83

Re: Zsh completion

Rehash was what I was looking for, thanks.  I found a way to have it done automatically:

_force_rehash() {
  (( CURRENT == 1 )) && rehash
  return 1    # Because we didn't really complete anything
}

zstyle ':completion:*' completer \
  _oldlist _expand _force_rehash _complete

Offline

Board footer

Powered by FluxBB