#StackBounty: #zsh #autocomplete #tab-completion #globbing How do I get zsh tab completion to "vi **/foo<TAB>" to match…

Bounty: 150

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.

Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.