plugins/.nmv | 6 ++++++ src/nnn.c | 3 +++ diff --git a/plugins/.nmv b/plugins/.nmv index 37b77995bd0bb6408732a885c7701c35d7126fdd..66ca6b3f42a253ee028c527014cfcb7c0bf47336 100755 --- a/plugins/.nmv +++ b/plugins/.nmv @@ -5,6 +5,7 @@ # # 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 +# To use NNN_LIST your shell must support readlink(1) # # Capabilities: # 1. Basic file rename @@ -21,6 +22,7 @@ TMPDIR="${TMPDIR:-/tmp}" INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}" VERBOSE="${VERBOSE:-0}" RECURSIVE="${RECURSIVE:-0}" +NNN_LIST="${NNN_LIST:-0}" selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} exit_status=0 @@ -61,6 +63,10 @@ printf "%s" "$arr" | awk '{printf("%'"${width}"'d %s\n", NR, $0)}' > "$dst_file" items=("~") while IFS='' read -r line; do + if [ "$NNN_LIST" -eq 1 ]; then + line=$(readlink "$line" || printf "%s" "$line") + fi + items+=("$line"); done < <(printf "%s\n" "$arr") diff --git a/src/nnn.c b/src/nnn.c index 020cba43e6adc2acb858c79f6b6ada11bd7451f2..2a2627a2fba3abe697fe76dcc400e9efdc58bac9 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -7269,6 +7269,9 @@ break; case SEL_RENAMEMUL: endselection(TRUE); setenv("INCLUDE_HIDDEN", xitoa(cfg.showhidden), 1); + setenv("NNN_LIST", listpath + ? xitoa(is_prefix(path, listpath, xstrlen(listpath))) + : "0", 1); if (!(getutil(utils[UTIL_BASH]) && plugscript(utils[UTIL_NMV], F_CLI))