Skip to content

Commit

Permalink
Merge pull request #1712 from Rahlir/plugin-fzopen-fix
Browse files Browse the repository at this point in the history
Fix bug in fzopen when selection is canceled
  • Loading branch information
jarun authored Aug 16, 2023
2 parents 186f9d0 + e500179 commit 66f636d
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions plugins/fzopen
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,27 @@ if [ "$3" ]; then
exit 0
fi

if [ "$USE_NUKE" -ne 0 ]; then
"$NUKE" "$entry"
exit 0
fi
if [ "$entry" ]; then
if [ "$USE_NUKE" -ne 0 ]; then
"$NUKE" "$entry"
exit 0
fi

# Open the file (works for a single file only)
cmd_file=""
cmd_open=""
if uname | grep -q "Darwin"; then
cmd_file="file -bIL"
cmd_open="open"
else
cmd_file="file -biL"
cmd_open="xdg-open"
fi
# Open the file (works for a single file only)
cmd_file=""
cmd_open=""
if uname | grep -q "Darwin"; then
cmd_file="file -bIL"
cmd_open="open"
else
cmd_file="file -biL"
cmd_open="xdg-open"
fi

case "$($cmd_file "$entry")" in
*text*)
"${VISUAL:-$EDITOR}" "$entry" ;;
*)
$cmd_open "$entry" >/dev/null 2>&1 ;;
esac
case "$($cmd_file "$entry")" in
*text*)
"${VISUAL:-$EDITOR}" "$entry" ;;
*)
$cmd_open "$entry" >/dev/null 2>&1 ;;
esac
fi

0 comments on commit 66f636d

Please sign in to comment.