diff options
| author | --global <ik.boikov.public@protonmail.com> | 2021-02-05 20:40:11 +0100 |
|---|---|---|
| committer | --global <ik.boikov.public@protonmail.com> | 2021-02-05 20:40:11 +0100 |
| commit | 71a79806a0742b9748a218da2036a51f29c45513 (patch) | |
| tree | 221d40af216297981243208cff94dfe04c26aecb /nnn | |
| parent | 454fc2b44e4e88bd94e23f0c8f149d006d81ff83 (diff) | |
some nnn plugins
Diffstat (limited to 'nnn')
| -rw-r--r-- | nnn/.config/nnn/plugins/mediainf | 13 | ||||
| -rw-r--r-- | nnn/.config/nnn/plugins/mimelist | 15 | ||||
| -rw-r--r-- | nnn/.config/nnn/plugins/picker | 26 |
3 files changed, 54 insertions, 0 deletions
diff --git a/nnn/.config/nnn/plugins/mediainf b/nnn/.config/nnn/plugins/mediainf new file mode 100644 index 0000000..22ae824 --- /dev/null +++ b/nnn/.config/nnn/plugins/mediainf @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +# Description: Show media information of a file in pager +# +# Dependencies: mediainfo +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +if [ -n "$1" ] && [ -f "$1" ]; then + mediainfo "$1" | $PAGER + # exiftool "$1" | $PAGER +fi diff --git a/nnn/.config/nnn/plugins/mimelist b/nnn/.config/nnn/plugins/mimelist new file mode 100644 index 0000000..d601cd8 --- /dev/null +++ b/nnn/.config/nnn/plugins/mimelist @@ -0,0 +1,15 @@ + +#!/usr/bin/env sh + +# Description: Find and list files by mime type in smart context +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +. "$(dirname "$0")"/.nnn-plugin-helper + +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" diff --git a/nnn/.config/nnn/plugins/picker b/nnn/.config/nnn/plugins/picker new file mode 100644 index 0000000..93acca5 --- /dev/null +++ b/nnn/.config/nnn/plugins/picker @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +# Description: Pick files and pipe the newline-separated list to another utility +# +# Usage: +# Copy this file in your $PATH, make it executable and preferably name it to picker. +# Run commands like: +# ls -l `picker` +# cd `picker` +# vimdiff `picker` +# or, in fish shell: +# ls -l (picker) +# cd (picker) +# vimdiff (picker) +# +# Note: This use case is limited to picking files, other functionality may not work as expected. +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +nnn -p /tmp/picked + +if [ -f /tmp/picked ]; then + tr '\0' '\n' < /tmp/picked + rm /tmp/picked +fi |
