2

Possible Duplicate:
rebuild auto-complete index (or whatever it's called)

After I install something via aptitude, zsh won't be able to find it until I search for it with which. For example

~ sudo apt-get install xsane
~ xsa<Tab>
~ saned
~ which xsane
/usr/bin/xsane
~xsa<Tab>
~xsane

This naturally is pretty annoying. Is there a zsh setting for this? Or is it a bug? Or what?

Falmarri
  • 13,047
  • 1
    @Maciej: This isn't quite the same question: the other question is about rebuilding the cache manually, this one is about doing it automatically. – Gilles 'SO- stop being evil' Nov 08 '10 at 01:54
  • @Gilles I think the answers are probably the same though (and your accepted answer on the other question covers this already) – Michael Mrozek Nov 08 '10 at 01:55
  • 1
    You can tell zsh not to trust its cache when completing with zstyle ":completion:*:commands" rehash 1. There is a performance cost, but it is negligible on a typical desktop setting today. (It isn't if you have $PATH on NFS, or a RAM-starved system.) For a one-time need, run rehash to rebuild the command cache. – Gilles 'SO- stop being evil' Nov 08 '10 at 01:55
  • @Michael: I don't think my answer on the other command covers Falmarri's question. I was in the process of writing one (see previous comment) when the closed question notice came. – Gilles 'SO- stop being evil' Nov 08 '10 at 01:58
  • @Gilles Oh, hash_list_all isn't it? Well, I'll reopen this; if it is a dupe it can always be closed again and merged – Michael Mrozek Nov 08 '10 at 01:59
  • Hmm "After installing new software, an already opened terminal with zsh won't know about the new commands, and cannot generate auto-complete for those" vs. "After I install something via aptitude, zsh won't be able to find it until I search for it with which" sounds rather similar. Could anyone explain what is the difference - both are about autocompletion problem after something was installed. – Maja Piechotka Nov 08 '10 at 02:19
  • Well I tried the hash_list_all and it didn't work. I'm seeing the same behaviour. – Falmarri Nov 08 '10 at 02:41
  • Gilles’ comment/answer of zstyle ":completion:*:commands" rehash 1 works in Zsh 4.3.3 and later. – Chris Johnsen Nov 08 '10 at 06:33
  • @Maciej, @Michael: now that I've slept on it, I agree with the merge. Sorry about that. I'll either make my comment into an answer here or merge it into my answer there tonight. – Gilles 'SO- stop being evil' Nov 08 '10 at 08:22

0 Answers0