plugins/.nmv | 8 ++++++-- src/nnn.c | 7 +++++-- diff --git a/plugins/.nmv b/plugins/.nmv index 8b080ae2f828ee640302ba34f2aaf01b1737bad5..b89842f0a652634671483cd9ad5e0cd49cdb0e7d 100755 --- a/plugins/.nmv +++ b/plugins/.nmv @@ -26,6 +26,10 @@ if [ -s "$selection" ]; then printf "Rename 'c'urrent / 's'election? " read -r resp + + if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then + exit 1 + fi fi if [ "$resp" = "s" ]; then @@ -96,7 +100,7 @@ else printf "%s: failed to rename %s to %s: %s\n" "$0" "$name" "$tmp" "$!" > /dev/stderr exit_status=1 fi - + for key in "${!items[@]}"; do if [ "${items[$key]}" = "$name" ]; then items[$key]="$tmp" @@ -116,7 +120,7 @@ if [ -d "$name" ]; then for key in "${!items[@]}"; do items[$key]=$(printf "%s" "${items[$key]}" | sed "s|^$src\(\$\|\/\)|$name\1|") done - + printf "'%s' => '%s'\n" "$src" "$name" else printf "'%s' -> '%s'\n" "$src" "$name" diff --git a/src/nnn.c b/src/nnn.c index 1e0933ecf1c38deb8fe826dc8622f67614f98059..2810e0cbd78caa13fbc4ded2592fa9acb2fba264 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -431,7 +431,8 @@ #define UTIL_FZF 15 #define UTIL_FZY 16 #define UTIL_NTFY 17 #define UTIL_CBCP 18 -#define UTIL_NMV 19 +#define UTIL_BASH 19 +#define UTIL_NMV 20 /* Utilities to open files, run actions */ static char * const utils[] = { @@ -470,6 +471,7 @@ "fzf", "fzy", ".ntfy", ".cbcp", + "bash", ".nmv", }; @@ -5610,7 +5612,8 @@ break; case SEL_RENAMEMUL: endselection(); - if (!plugscript(utils[UTIL_NMV], newpath, path, F_CLI) + if (!(getutil(utils[UTIL_BASH]) + && plugscript(utils[UTIL_NMV], newpath, path, F_CLI)) && !batch_rename(path)) { printwait(messages[MSG_FAILED], &presel); goto nochange;