In bash, if you hit tab when there are multiple possible completions you get a list of matches that keeps reprinting if you repeatedly press tab. In tcsh, setting autocomplete to enhanced also achieves this.

In zsh, you do get the list of matches, but on 2nd, 3rd tab press it starts cycling through matches. Is there a way to get zsh to do the equivalent of bash's show-all-if-ambiguous without the cycling?

I'm not looking for the clever but useless "why would you press tab several times if it displayed after the first?". If I had been able to adjust my habits I'd have done so by now.

migrated from stackoverflow.com Apr 26 '11 at 12:11

This question came from our site for professional and enthusiast programmers.


Zsh has a lot of completion-related options (see man zshoptions under Completion). I think you're after setopt no_auto_menu and perhaps setopt bash_auto_list as well.

  • Sorry, I phrased my question badly. I want to know how to disable tab completion cycling. I think I'll start a new question. – Anonymous Apr 22 '11 at 18:01
  • 3
    @user714112: setopt no_auto_menu does disable tab completion cycling: if you press Tab and the current prefix is ambiguous, you see a menu, and that's it, the command line won't change. – Gilles Apr 22 '11 at 18:31
  • Thank you, you're right. I'm not sure why I didn't see that earlier. Is it possible to get it to redisplay the list on 2nd, 3rd, 4th TAB instead of nothing? Human instinct is to think your keyboard isn't working if nothing happens on 2nd, 3rd, 4th tab keypress. – user7000 May 1 '11 at 10:10
  • @user7000: Again, it does redisplay the list each time you press Tab. If I clear the screen from the terminal emulator menu, or create a file, then press Tab again, zsh redisplays the list and shows the new file. (Just tested with zsh 4.3.4, and I don't think that behavior has changed in a long time.) – Gilles May 1 '11 at 10:59
  • 1
    I finally got the solution. I needed your 2 options plus removing ALWAYS_LAST_PROMPT. So this gives me the elusive behavior I wanted: setopt bash_auto_list; setopt no_auto_menu; unsetopt ALWAYS_LAST_PROMPT; Once again, thank you for helping me out with this. I appreciate your persistence – user7000 May 17 '11 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.