I like zsh's autocorrect for commands. It has an annoying feature, however: sometimes I try to run a command, notice it doesn't exist, install it, then try to run it again, and zsh still wants to make the same correction. Zsh does this because keeps a hash of command paths, and it doesn't go beyond the hash when doing autocorrection. If I say n to the correction after installing the command, the command does run, but I have to say n again each time I want to run the command, or update the command hash in each running instance by calling the hash builtin.
I do want zsh to keep a hash of command paths, and I want to keep autocorrection (i.e. I type a command name and press Enter as usual, and zsh suggests a correction if the command does not exist). However, I want “the command does not exist” to mean that the command is not on $path at this point in time, not that the command is does not exist.
Steps to reproduce:
$ mkdir /tmp/test $ cp /bin/true /tmp/test/wibble $ PATH=/tmp/test:/bin zsh -f -o correct darkstar% wobble zsh: correct 'wobble' to 'wibble' [nyae]? a darkstar% cp /tmp/test/{wibble,wobble} darkstar% wobble zsh: correct 'wobble' to 'wibble' [nyae]? n Desired behavior: when wobble exists, don't prompt to correct it. How can I do this?
wobblewithout action. zsh 5.4.1 on fedora 27. All my *hash* options are set to "off".hashoptions, meaning thathash_list_all,hash_cmdsandhash_dirsare on.rehashbefore trying the autocompletion again?