Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: HASH_LIST_ALL?



On Wed, 13 Oct 2004, Matt Garman wrote:

> rehashComplete() {
>     rehash;
>     zle expand-or-complete;
> }

Egad.  That means you're rehashing on every completion, not just on every 
command completion.  What a terrific waste of time and CPU.  If you're
using compsys, the right way to do this is by adding to your completer
zstyle:

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

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

(where "..." is the rest of whatever you already have in that style).

> That works (meaning, it makes the shell behave as I want), but I was
> just hoping there was a simpler method, i.e. "setopt something".

Unfortunately, there's not.  Command completion uses the $command variable 
from the zsh/parameter module, which means it forces command hashing to 
occur even if you (un)set all the options that otherwise turn hashing off.



Messages sorted by: Reverse Date, Date, Thread, Author