Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In zsh and in bash, if I type ls c<TAB> it displays every filename starting with c. If instead I type ls c*<TAB>, bash behaves the same way, but zsh replaces the c* with the list of every file starting with c. Is there any way to make zsh behave like bash does?

share|improve this question

1 Answer 1

setopt GLOB_COMPLETE

From man zshoptions:

GLOB_COMPLETE

When the current word has a glob pattern, do not insert all the words resulting from the expansion but generate matches as for completion and cycle through them like MENU_COMPLETE. The matches are generated as if a ‘*’ was added to the end of the word, or inserted at the cursor when COMPLETE_IN_WORD is set. This actually uses pattern matching, not globbing, so it works not only for files but for any completion, such as options, user names, etc.

Note that when the pattern matcher is used, matching control (for example, case-insensitive or anchored matching) cannot be used. This limitation only applies when the current word contains a pattern; simply turning on the GLOB_COMPLETE option does not have this effect.

share|improve this answer
    
That just replaces the pattern with the first match rather than all the matches. I want to only list the matches. –  m42a May 6 '12 at 6:47
    
If you keep hitting tab, it should cycle through the matches. If it's not also displaying the list of matches, you may have to mess with your zsh completion options. –  mkarasek May 6 '12 at 23:47
    
I don't want to cycle through options though, I only want to list them. –  m42a May 7 '12 at 8:11
    
@m42a: Did you ever figure out how to do that? –  paraxor May 6 '13 at 0:11
    
@m42a you may want to set menu_complete and auto_list. –  PythonNut Aug 26 at 22:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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