nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a6eeceec554dc95ddcc123f6dc0d0ade0c548b83
parent f6b14f6505bd8887b37fee4e2269ac9940607993
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Fri, 28 May 2021 23:46:00 +0530

fzdirs - check if the first entry in path-list exists

Diffstat:
Mplugins/fzdirs | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/fzdirs b/plugins/fzdirs @@ -8,7 +8,8 @@ # Paths can be file paths; the script will scan the parent dirs. # # The path-list file precedence is: -# - "$1" (the hovered file) if it exists and is plaintext +# - "$1" (the hovered file) if it exists, is plain-text and the +# first line points to an existing file # - "$LIST" if set below # - "$2" (the current directory) [mimics plugin fzcd behaviour] # @@ -29,7 +30,7 @@ IFS="$(printf '\n\r')" CTX=+ LIST="$LIST" -if [ -n "$1" ] && [ $(file -b --mime-type "$1") = 'text/plain' ]; then +if [ -n "$1" ] && [ "$(file -b --mime-type "$1")" = 'text/plain' ] && [ -e "$(head -1 "$1")" ]; then LIST="$1" elif ! [ -s "$LIST" ]; then LIST="$2"