commit d87414eb61c1349c9eb00ff5bdc9ae20fde1eddb
parent 488fe6b941122aa525fe3145adab7ec5446cda42
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Sun, 6 Jun 2021 17:07:23 +0530
Plugin fzcd - decouple from selection
Diffstat:
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/plugins/README.md b/plugins/README.md
@@ -25,7 +25,7 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
| [dups](dups) | List non-empty duplicate files in current dir | bash | find, md5sum,<br>sort uniq xargs |
| [finder](finder) | Run custom find command and list | sh | - |
| [fixname](fixname) | Clean filename to be more shell-friendly [✓] | bash | sed |
-| [fzcd](fzcd) | Fuzzy search multiple dirs (or `$PWD`) and visit file [✓] | sh | fzf, (fd) |
+| [fzcd](fzcd) | Fuzzy search multiple dirs (or `$PWD`) and visit file | sh | fzf, (fd) |
| [fzhist](fzhist) | Fuzzy-select a cmd from history, edit in `$EDITOR` and run | sh | fzf, mktemp |
| [fzopen](fzopen) | Fuzzy find file(s) in subtree to edit/open/pick | sh | fzf, xdg-open |
| [fzplug](fzplug) | Fuzzy find, preview and run other plugins | sh | fzf |
diff --git a/plugins/fzcd b/plugins/fzcd
@@ -17,9 +17,6 @@
# - pick the (file)paths in picker mode to path-list file
# - OR, edit selection in nnn and save as path-list file
#
-# The plugin clears nnn selection as the user can be tempted to delete
-# duplicate files after finding copies and remove selection by mistake.
-#
# Shell: POSIX compliant
# Author: Anna Arad, Arun Prakash Jana
@@ -39,11 +36,6 @@ fi
if [ -n "$1" ] && [ "$(file -b --mime-type "$1")" = 'text/plain' ] && [ -e "$(head -1 "$1")" ]; then
LIST="$1"
elif ! [ -s "$LIST" ]; then
- # Clear selection
- if [ -p "$NNN_PIPE" ]; then
- printf "-" >"$NNN_PIPE"
- fi
-
sel=$(fzf)
# Show only the file and parent dir
# sel=$(fzf --delimiter / --with-nth=-2,-1 --tiebreak=begin --info=hidden)
@@ -63,11 +55,6 @@ if [ -n "$LIST" ]; then
fi
done < "$LIST"
- # Clear selection
- if [ -p "$NNN_PIPE" ]; then
- printf "-" >"$NNN_PIPE"
- fi
-
sel=$(xargs -d '\n' -a "$tmpfile" fd -H . | fzf --delimiter / --tiebreak=begin --info=hidden)
rm "$tmpfile"