aboutsummaryrefslogtreecommitdiff
path: root/bindings.bb
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-11-11 11:44:45 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-11-11 11:44:45 -0800
commit30519ab5d8e0ddd781a0f4ae5cbf1f8933b93a4a (patch)
treebb0c9f556147fb74ed3a39eeb1b35bbe907a0c05 /bindings.bb
parent37b94e9ac2f3760aeed46537bec3a7a34e19e3c8 (diff)
Switched bindings to use `expr` instead of `grep` for opening
Diffstat (limited to 'bindings.bb')
-rw-r--r--bindings.bb9
1 files changed, 4 insertions, 5 deletions
diff --git a/bindings.bb b/bindings.bb
index f83db92..f63aa91 100644
--- a/bindings.bb
+++ b/bindings.bb
@@ -99,13 +99,12 @@ Left click: # Move cursor to file
bb +goto:"$BBCLICKED"
fi
Enter,Double left click: # Open file/directory
- if [ "$(uname)" = "Darwin" ]; then
- if [ -d "$BBCURSOR" ]; then bb +cd:"$BBCURSOR";
- elif file -bI "$BBCURSOR" | grep -q '^\(text/\|inode/empty\)'; then $EDITOR "$BBCURSOR";
+ if [ -d "$BBCURSOR" ]; then bb +cd:"$BBCURSOR";
+ elif [ "$(uname)" = "Darwin" ]; then
+ if expr "$(file -bI "$BBCURSOR")" : '\(text/\|inode/empty\)' >/dev/null; then $EDITOR "$BBCURSOR";
else open "$BBCURSOR"; fi
else
- if [ -d "$BBCURSOR" ]; then bb +cd:"$BBCURSOR";
- elif file -bi "$BBCURSOR" | grep -q '^\(text/\|inode/x-empty\)'; then $EDITOR "$BBCURSOR";
+ if expr "$(file -bi "$BBCURSOR")" : '\(text/\|inode/x-empty\)' >/dev/null; then $EDITOR "$BBCURSOR";
else xdg-open "$BBCURSOR"; fi
fi
e: # Edit file in $EDITOR