the rename plugin always asks for "selection vs current" even when -u
flag is active. pass it to the plugin via `NNN_PREFER_SELECTION` so that
there's less distracting prompts.
EDITOR="${EDITOR:-vi}"
TMPDIR="${TMPDIR:-/tmp}"
NNN_INCLUDE_HIDDEN="${NNN_INCLUDE_HIDDEN:-0}"
+NNN_PREFER_SELECTION="${NNN_PREFER_SELECTION:-0}"
VERBOSE="${VERBOSE:-0}"
RECURSIVE="${RECURSIVE:-0}"
dst_file=$(mktemp "$TMPDIR/.nnnXXXXXX")
if [ -s "$selection" ]; then
- printf "Rename 'c'urrent / 's'election? "
- read -r resp
+ if [ "$NNN_PREFER_SELECTION" -eq 1 ]; then
+ resp="s"
+ else
+ printf "Rename 'c'urrent / 's'election? "
+ read -r resp
- if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then
- exit 1
- fi
+ if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then
+ exit 1
+ fi
+ fi
fi
if [ "$resp" = "s" ]; then
case SEL_RENAMEMUL:
endselection(TRUE);
setenv("NNN_INCLUDE_HIDDEN", xitoa(cfg.showhidden), 1);
+ setenv("NNN_PREFER_SELECTION", xitoa(cfg.prefersel), 1);
setenv("NNN_LIST", listpath ? listroot : "", 1);
if (!(getutil(utils[UTIL_BASH])