aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/.nmv
diff options
context:
space:
mode:
authorGravatar KlzXS <azszwymmvqdi@yahoo.com>2020-04-20 19:09:30 +0200
committerGravatar GitHub <noreply@github.com>2020-04-20 22:39:30 +0530
commit00148360e4452ae24a43a15b0833c49b7b4e4347 (patch)
treedbce8d0f214c8666531c014545000634862c0085 /plugins/.nmv
parentd549ae748626e648eeca7926569598f8d2653714 (diff)
downloadnnn-00148360e4452ae24a43a15b0833c49b7b4e4347.tar.gz
Plugin improvements (#531)
* Added padding for numbers in .nmv * Add skim as an option in fzopen * Remove unnecessary eval Thanks @leovilok! Co-Authored-By: lvgx <l@vgx.fr> * Added note about whitespace Co-authored-by: lvgx <l@vgx.fr>
Diffstat (limited to 'plugins/.nmv')
-rwxr-xr-xplugins/.nmv7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/.nmv b/plugins/.nmv
index 01e35da..023328d 100755
--- a/plugins/.nmv
+++ b/plugins/.nmv
@@ -3,6 +3,8 @@
# Description: An almost fully POSIX compliant batch file renamer
#
# Note: nnn auto-detects and invokes this plugin if available
+# Whitespace is used as delimiter for read.
+# The plugin doesn't support filenames with leading or trailing whitespace
#
# Capabilities:
# 1. Basic file rename
@@ -43,7 +45,10 @@ else
fi
fi
-printf "%s" "$arr" | awk '{print NR " " $0}' > "$dst_file"
+lines=$(printf "%s\n" "$arr" | wc -l)
+width=${#lines}
+
+printf "%s" "$arr" | awk '{printf("%'"${width}"'d %s\n", NR, $0)}' > "$dst_file"
items=("~")
while IFS='' read -r line; do