aboutsummaryrefslogtreecommitdiff
path: root/files/.config/nnn/plugins/fzopen
diff options
context:
space:
mode:
Diffstat (limited to 'files/.config/nnn/plugins/fzopen')
-rwxr-xr-xfiles/.config/nnn/plugins/fzopen42
1 files changed, 22 insertions, 20 deletions
diff --git a/files/.config/nnn/plugins/fzopen b/files/.config/nnn/plugins/fzopen
index 17b0585..4303dc3 100755
--- a/files/.config/nnn/plugins/fzopen
+++ b/files/.config/nnn/plugins/fzopen
@@ -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