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

_files -g <pattern> offers files that don't match the pattern and conversely



Are these bugs or am I misunderstanding how the -g option works?

With zsh 5.8.1 (x86_64-ubuntu-linux-gnu) and an empty .zshrc.

% ls
a  b

% _f() { _files -g 'c(.)' }; compdef _f f
% f <tab>
a  b       # even though 'a' and 'b' don't match the pattern

However,

% _f() { _path_files -g 'c(.)' }; compdef _f f
% f <tab>  # nothing

Conversely,

% _f() { _files -g '^(a #)(.)' }; compdef _f f
% f <tab>  # nothing, even though 'b' matches the pattern

However,

% _f() { _path_files -g '^(a #)(.)' }; compdef _f f
% f <tab>  # becomes
% f b

Also, and this is the same for _files and _path_files:

% f() { echo $@ }
% _f() { _files -g 'c' }; compdef _f f
% f <tab>  # becomes
% f c      # even though there is no such file

--
Johan Grande




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