Skip to content

What filter to set to display only files with selected list of extensions? #762

@MahouShoujoMivutilde

Description

@MahouShoujoMivutilde

Let's say you have

/tmp/test ❯ ls
1A.txt  1B.txt  2.org  3.org  control  wtf.org.txt

And you want to display only *.org and *.txt files, including wtf... file, but excluding control.

Naturally you set filter to *.org *.txt (with set globsearch in lfrc) or to .org .txt (without).

But in first case all you get is an empty directory with such filter applied.

19-02-2022-14_42_09

In second - only `wtf...` file is matched

19-02-2022-14_47_35

In ranger, to achieve desired result you would set filter to .org|.txt.

And it will work

19-02-2022-14_48_32

(This pattern will also result in empty directory in lf, which makes sense, considering space seems to be the separator.)

After digging around the source, I found that isFiltered seems to be "exclude first" type of thing - if any of sub patterns not matched, file will not be displayed.

E.g. in my case, *.org files wont match *.txt and therefore wont be displayed, and vise versa.

I don't know if this is intended, but if basic feature parity with ranger's filter was the goal - it probably isn't.

Please correct me if I am missing something, but I don't see a way how can I achieve what is in the title.

(Tried on latest release r26 and latest master.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions