mirror of
https://github.com/jarun/nnn.git
synced 2025-01-15 21:36:42 +00:00
nmv: prefer selection if -u is active
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.
This commit is contained in:
parent
58b77411c8
commit
8ad5c87107
15
plugins/.nmv
15
plugins/.nmv
|
@ -20,6 +20,7 @@
|
||||||
EDITOR="${EDITOR:-vi}"
|
EDITOR="${EDITOR:-vi}"
|
||||||
TMPDIR="${TMPDIR:-/tmp}"
|
TMPDIR="${TMPDIR:-/tmp}"
|
||||||
NNN_INCLUDE_HIDDEN="${NNN_INCLUDE_HIDDEN:-0}"
|
NNN_INCLUDE_HIDDEN="${NNN_INCLUDE_HIDDEN:-0}"
|
||||||
|
NNN_PREFER_SELECTION="${NNN_PREFER_SELECTION:-0}"
|
||||||
VERBOSE="${VERBOSE:-0}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
RECURSIVE="${RECURSIVE:-0}"
|
RECURSIVE="${RECURSIVE:-0}"
|
||||||
|
|
||||||
|
@ -38,12 +39,16 @@ exit_status=0
|
||||||
dst_file=$(mktemp "$TMPDIR/.nnnXXXXXX")
|
dst_file=$(mktemp "$TMPDIR/.nnnXXXXXX")
|
||||||
|
|
||||||
if [ -s "$selection" ]; then
|
if [ -s "$selection" ]; then
|
||||||
printf "Rename 'c'urrent / 's'election? "
|
if [ "$NNN_PREFER_SELECTION" -eq 1 ]; then
|
||||||
read -r resp
|
resp="s"
|
||||||
|
else
|
||||||
|
printf "Rename 'c'urrent / 's'election? "
|
||||||
|
read -r resp
|
||||||
|
|
||||||
if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then
|
if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$resp" = "s" ]; then
|
if [ "$resp" = "s" ]; then
|
||||||
|
|
|
@ -7368,6 +7368,7 @@ nochange:
|
||||||
case SEL_RENAMEMUL:
|
case SEL_RENAMEMUL:
|
||||||
endselection(TRUE);
|
endselection(TRUE);
|
||||||
setenv("NNN_INCLUDE_HIDDEN", xitoa(cfg.showhidden), 1);
|
setenv("NNN_INCLUDE_HIDDEN", xitoa(cfg.showhidden), 1);
|
||||||
|
setenv("NNN_PREFER_SELECTION", xitoa(cfg.prefersel), 1);
|
||||||
setenv("NNN_LIST", listpath ? listroot : "", 1);
|
setenv("NNN_LIST", listpath ? listroot : "", 1);
|
||||||
|
|
||||||
if (!(getutil(utils[UTIL_BASH])
|
if (!(getutil(utils[UTIL_BASH])
|
||||||
|
|
Loading…
Reference in a new issue