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

Re: completer for file extensions



Mikael Magnusson wrote:
> I have a number of screenshots with . in the name and it causes these
> completions to be added;
> .00.png     .09.16.png  .13580      .16.png     .36.04.png  .58.png

> I guess you go for the first . to get stuff like .tar.gz? Tarballs

It takes all of them, so for foo-1.0.tar.gz, it will add .gz .tar.gz and
.0.tar.gz. Incidentally, that's what the {1.. brace expansion that was
mistakenly {1- is for (along with the I flag).

> often have . in the name for version numbers so I have the same issue
> in that directory;

Numbers alone are I think a rare choice for file extensions so I'll add
in:
  files=( ${files:#.<->(.*|)} )

You might still find cases where dots are used but not meant as
extensions: something like .rc2 or .5-dev-0 but you wouldn't want, e.g.
.mp3 filtered. You can always use an ignored-patterns style. The change
above is equivalent to doing:
  zstyle ':completion:*:extensions:*' ignored-patterns '.<->(.*|)'

Oliver



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