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

Re: auto-reflesh $PATH



On Mar 5,  5:53am, Kazuhiko Uebayashi wrote:
} Subject: Re: auto-reflesh $PATH
} 
} > ¹ <http://www.zsh.org/mla/users/2004/msg01066.html>
} 
}     zstyle ':completion:*' completer \
}       _oldlist _expand _force_rehash _complete
} 
} to my ~/.zshrc, auto-rehash works fine!

I'd forgotten about that article (and it wasn't obvious that was what
you were asking about).

It'd be interesting to try combining the two ideas, though:

    _force_rehash() {
      if (( CURRENT == 1 ))
      then
        local -a modified_path
        modified_path=( ${^path}(Nms$SECONDS) )
        (( $#modified_path )) && rehash
      fi
      return 1	# Because we didn't really complete anything
    }

I'd expect that to be less intrusive than running rehash on every
command completion, but I could be wrong about the cost of doing the
${^path}(Nms$SECONDS) glob.



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