From 00148360e4452ae24a43a15b0833c49b7b4e4347 Mon Sep 17 00:00:00 2001 From: KlzXS Date: Mon, 20 Apr 2020 19:09:30 +0200 Subject: [PATCH] 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 * Added note about whitespace Co-authored-by: lvgx --- plugins/.nmv | 7 ++++++- plugins/fzopen | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/.nmv b/plugins/.nmv index 01e35da4..023328df 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 diff --git a/plugins/fzopen b/plugins/fzopen index 068db1e9..9f5ff052 100755 --- a/plugins/fzopen +++ b/plugins/fzopen @@ -17,6 +17,8 @@ if which fzf >/dev/null 2>&1; then # entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden) elif which fzy >/dev/null 2>&1; then entry=$(find . -type f 2>/dev/null | fzy) +elif which sk >/dev/null 2>&1; then + entry=$(find . -type f 2>/dev/null | sk) else exit 1 fi