Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

How can I list only two file types (by their extensions) in a list using =?

Thank you

1 Answer

+1 vote
by
selected by
 
Best answer

Example for *.c and *.h files:

=\.(c|h)$
by
edited by

In VIFM to test the local filter =, I would like to know if the regex below is correct. Thank you in advance for your help and valuable advice. I took it from VIM editor

^					matches start of line

$					matches end of line

()					grouping Expressions

|					alternation operator (logical OR).

\a matches alphabet character, short-cut for [a-zA-Z]
alphabetic character		        abcd...xyz    but not    éäöü

\A matches other than alphabet [^a-zA-Z]
non-alphabetic character            éäöü [space]   but not    abcd...xyz

\d matches digit character [0-9]

\D matches other than digit [^0-9]

\l matches lowercase alphabets [a-z]

\L matches other than lowercase alphabets [^a-z]

\s matches white-space characters space and tab

\S non-whitespace character

\u matches uppercase alphabets [A-Z]

\U matches other than uppercase alphabets [^A-Z]

\x matches hexademical character [0-9a-fA-F]

\X matches other than hexademical [^0-9a-fA-F]

\w matches any alphanumeric character or underscore [a-zA-Z0-9_]

\W match other than alphanumeric character or underscore [^a-zA-Z0-9_]

[:alnum:] letters and digits

[:alpha:] letters

[:blank:] space and tab characters

[:cntrl:] control characters

[:digit:] decimal digits

[:graph:] printable characters excluding space

[:lower:] lowercase letters (all letters when
ignorecase is used)

[:print:] printable characters including space

[:punct:] punctuation characters

[:space:] whitespace characters

[:upper:] uppercase letters (all letters when
ignorecase is used)

[:xdigit:] hexadecimal digits

[:return:] the CR character

[:tab:] the Tab character

[:escape:] the Esc character

[:backspace:]		the BS character
by

Some of it will work in Vifm, but not everything. Unlike Vim Vifm doesn't have its own regexp implementation and uses extended regular expressions of POSIX, so see man 7 regex and add Vim's \C and \c to that (as mentioned in the docs).

Some [: ... :] will work. Special characters like ^$*+|.?[^]{,} work. Somehow \s\S\w\W also seem to work (I didn't notice this before, may be a recent addition), but others still don't (although Vifm could probably replace them with equivalent sequences).

by

@xaizek thanks, I understand. What is your point of view about implementing an history, by pressing the up arrow or down arrow, for the local filter = like in :

: command-line mode with colon

or

/ search forward with slash

or

? search backward with question mark

by

Local filter already has history. Yours may be empty if 'vifminfo' doesn't include fhistory value.

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...