Considering this question and its answer, one may be tempted to write something like this to configure a viewer for all text files:
fileviewer <text/*> /my/text/viewer %c
However, at least when vifm is built with GLib, there is a number of specific MIME types for particular kinds of plain text outside of text/ category:
┌── File Information ───────────────────┐
│ │
│ Path: /home/intelfx │
│ Name: file.json │
│ Size: 3.9 K (3974 bytes) │
│ Type: JSON text data │
│ Mime Type: application/json │
│ Hard Links: 1 │
│ Modified: Вт, 06 фев 2024 11:10:38 │
│ Accessed: Пт, 14 июн 2024 13:56:49 │
│ Changed: Пт, 14 июн 2024 14:10:17 │
│ Permissions: -rw-r--r-- (644) │
│ Owner: intelfx (1000) │
│ Group: intelfx (1000) │
└───────────────────────────────────────┘
There is quite a number of such MIME types (the second filtering is here to count non-<text/> types) inheriting from <text/>:
$ rg 'sub-class-of type="text/.+"' /usr/share/mime | rg -v '/usr/share/mime/text' | wc -l
338
There are also inheritance chains of length > 1:
$ rg 'sub-class-of type="text/.+"' /usr/share/mime -l | rg '/usr/share/mime/(.+)\.xml' -or '$1' | xargs -I{} rg "-e=sub-class-of type=\"{}\"" /usr/share/mime | wc -l
242
Is there a reliable way to identify all such files within :fileviewer/:filetype?