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.

How do I get zsh tab completion to cat **/foo<TAB> to match and complete the first file matching foo* in any subdirectory under the current directory?

For example, do this while inside a fresh test directory: (again, this is zsh)

% mkdir aaa bbb ccc
% touch aaa/foo bbb/foo ccc/foo
% cat **/f<TAB>

What I want when I hit <TAB> on that last line is for my screen to end up looking like this:

% cat aaa/foo_                 # filled in the first match; "_" is the cursor
aaa/foo  bbb/foo  ccc/foo      # and here is the list of all matches

I tried setopt GLOB_COMPLETE, but that didn't do what I wanted.

share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.