tags:

views:

39

answers:

1

I just started using Zsh lately for some of the integrated support in the shell prompt for my Git status etc.

When I type in ruby -v, to confirm the version of ruby I'm running, Zsh asks if I want to change the command to _ruby. Well after saying no at the prompt and the command completing as expected I continue to get the question at the prompt after confirming my command is correct.

I'm assuming there is a completion file or something of the sort.

Thanks

*Update:

The shell is no longer trying to complete _ruby, it stopped responding after closing the shell a few times some how.

I tried to clean the file up several times but there is a "opts" variable that is 50 or more lines long and the lines are all ran together, some lines more than 150 characters. Maybe I could email an attachment to you if you still want to see it. I sincerely apologize for the messy post.

+2  A: 

This is command autocorrection, activated by the correct option. It has nothing to do with completion. You're seeing _ruby because zsh thinks there is no ruby command and it offers _ruby as the nearest existing match.

If you've just installed ruby, it's possible that zsh has memorized the list of available command earlier, and it won't always try to see if the command has appeared in between. In that case, run hash -rf. Future zsh sessions won't have this problem since the ruby command already existed when they started.

Sometimes, when you change your PATH, zsh forgets some hashed commands. The option hash_listall helps against this. As above, if you can force zsh to refresh its command cache with hash -rf.

Gilles
@Gilles that is definitely what was going on. It seems it corrected itself after a bit. It may have restarting the shell or from logging out. I can't recall if I logged out so I don't want to say it corrected only by restarting the shell. The only thing that puzzles me is how the command completes successfully when opting out to let zsh change it. I guess as you were saying it had something to do with the shell not "knowing" about the ruby command being available at the time.Thanks for the answer
Joe Ryan