]> Sergey Matveev's repositories - nnn.git/commitdiff
Tweak fzopen to show parent dir and filename with fzf
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 20 Feb 2020 03:07:49 +0000 (08:37 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 20 Feb 2020 03:07:49 +0000 (08:37 +0530)
plugins/fzopen

index 91a504d525c2611911e59263b2e0e0739ca7175a..7205b7abfdc9b1867a355da30671b4a58d0ac264 100755 (executable)
 # Author: Arun Prakash Jana
 
 if which fzf >/dev/null 2>&1; then
-    fuzzy=fzf
+    entry=$(find . -type f 2>/dev/null | fzf --delimiter / --nth=-1 --tiebreak=begin --info=hidden)
+    # To show only the file name
+    # entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden)
 elif which fzy >/dev/null 2>&1; then
-    fuzzy=fzy
+    entry=$(find . -type f 2>/dev/null | fzy)
 else
     exit 1
 fi
 
-entry="$(find . -type f 2>/dev/null | "$fuzzy")"
-
 case "$(file -biL "$entry")" in
     *text*)
         "${VISUAL:-$EDITOR}" "$entry" ;;