]> Sergey Matveev's repositories - nnn.git/commitdiff
Plugin fzcd - decouple from selection
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 6 Jun 2021 11:37:23 +0000 (17:07 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 6 Jun 2021 11:37:23 +0000 (17:07 +0530)
plugins/README.md
plugins/fzcd

index 5566f0e42a9ca86dfc6269978b6c6990c298d5bd..8502fe42fcbd2e0a33c13013b127b74750342e74 100644 (file)
@@ -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 |
index ae3339246939a49f133750c069e0e499c801bb15..64c9a541d0c3a8caaa2f23a174896beb36bc4426 100755 (executable)
@@ -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"