nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b492dfd7ca7875ae39a3eb6b72e47f9b4be88996
parent fa7c19c4097bfb71eef16060724c5bd8da424a9e
Author: KlzXS <klzx+github@klzx.cf>
Date:   Sun,  3 Oct 2021 11:42:02 +0200

Added recursive capabilities to .nmv

Diffstat:
Mplugins/.nmv | 15++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/plugins/.nmv b/plugins/.nmv @@ -20,6 +20,7 @@ EDITOR="${EDITOR:-vi}" TMPDIR="${TMPDIR:-/tmp}" INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}" VERBOSE="${VERBOSE:-0}" +RECURSIVE="${RECURSIVE:-0}" selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} exit_status=0 @@ -38,11 +39,19 @@ fi if [ "$resp" = "s" ]; then arr=$(tr '\0' '\n' < "$selection") else + findcmd="find . ! -name ." + + if [ "$RECURSIVE" -eq 0 ]; then + findcmd="$findcmd -prune" + fi + if [ "$INCLUDE_HIDDEN" -eq 0 ]; then - arr=$(find . ! -name . -prune ! -name ".*" -print | sort) - else - arr=$(find . ! -name . -prune -print | sort) + findcmd="$findcmd ! -name \".*\"" fi + + findcmd="$findcmd -print" + + arr=$(eval "$findcmd" | sort) fi lines=$(printf "%s\n" "$arr" | wc -l)