Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: "fake" style requires at least one real match?



On Nov 4,  3:00pm, Oliver Kiddle wrote:
} Subject: Re: "fake" style requires at least one real match?
}
} Bart wrote:
} > This is essentially the same Q-and-A as from users/10988 almost exactly
} > ten years ago.  The difference is that the solution in that message no
} > longer works.
} >
} > zstyle -e ':completion::complete:cd:*:named-directories-mine' \
} > ignored-patterns 'reply=("(${(qkj.|.)nameddirs})")'
} 
} In my testing, the (q) flag in there is preventing ignored-patterns
} from working because the | separators get quoted.

That may be true, but I can reproduce with a different pattern that is
neither eval'd nor (q)'d.

With this:

setopt cdablevars
mydirs=( mydir1 mydir2 )
zstyle -e ':completion::complete:cd:*:named-directories-mine' \
    fake 'reply=($mydirs)'
zstyle ':completion::complete:cd:*:named-directories-mine' \ 
    ignored-patterns '?[^y]*'
zstyle ':completion::complete:cd:*' tag-order \
	'named-directories:-mine:extra\ directories'

That should ignore anything that doesn't have a "y" as the second
character, and show only the corresponding subset of nameddirs.

% hash -d move=$PWD
% hash -d home=$HOME
% cd m<TAB>
move    mydir1  mydir2

Why wasn't "move" ignored here?  (I had to have at least one character
of prefix to get it to offer named-directories at all.)

After adding a few more styles to format the listing:

torch% cd m
Completing extra directories
move    mydir1  mydir2

So it's using the named-directories-mine context, but it's including
a word that it shouldn't.

This doesn't always happen.  If I switch to local-directories in the
above, it works as expected.  So maybe there's some interaction with
using the -a or -k options to compadd.



Messages sorted by: Reverse Date, Date, Thread, Author