Zsh wants to autocorrect a command, with an _ before it

后端 未结 6 1469
终归单人心
终归单人心 2021-01-30 00:11

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

6条回答
  •  無奈伤痛
    2021-01-30 00:25

    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.

提交回复
热议问题