diff options
| author | Anton Bobov <anton@bobov.name> | 2026-08-20 15:13:47 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2026-08-20 15:13:47 +0500 |
| commit | 153c9344e93662984b1a5368a2722c10117db830 (patch) | |
| tree | 46b44af16387c815ab6c783415ee7dc1b8287a5c /files/.config/nnn/plugins/mimelist | |
| parent | ccbc3e18f711c39482e9ed6045ed99b4da889a59 (diff) | |
nnn: update plugins
Diffstat (limited to 'files/.config/nnn/plugins/mimelist')
| -rwxr-xr-x | files/.config/nnn/plugins/mimelist | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/files/.config/nnn/plugins/mimelist b/files/.config/nnn/plugins/mimelist index ccfe05a..3813c09 100755 --- a/files/.config/nnn/plugins/mimelist +++ b/files/.config/nnn/plugins/mimelist @@ -2,8 +2,12 @@ # Description: Find and list files by mime type in smart context # +# Dependencies: +# - file +# - mimetype (optional, PERL File MimeInfo) +# # Shell: POSIX compliant -# Author: Arun Prakash Jana +# Author: Arun Prakash Jana, Michel DHOOGE # shellcheck disable=SC1090,SC1091 . "$(dirname "$0")"/.nnn-plugin-helper @@ -12,4 +16,8 @@ printf "mime (e.g., video/audio/image): " read -r mime printf "%s" "+l" > "$NNN_PIPE" -find . | file -if- | grep "$mime" | awk -F: '{printf "%s\0", $1}' > "$NNN_PIPE" +if type mimetype >/dev/null 2>&1; then + find . | mimetype -f - | grep "$mime" | awk -F: '{printf "%s%c", $1, 0}' > "$NNN_PIPE" +else + find . | file -if- | grep "$mime" | awk -F: '{printf "%s%c", $1, 0}' > "$NNN_PIPE" +fi |
