diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-11-11 11:44:45 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-11-11 11:44:45 -0800 |
| commit | 30519ab5d8e0ddd781a0f4ae5cbf1f8933b93a4a (patch) | |
| tree | bb0c9f556147fb74ed3a39eeb1b35bbe907a0c05 /bindings.bb | |
| parent | 37b94e9ac2f3760aeed46537bec3a7a34e19e3c8 (diff) | |
Switched bindings to use `expr` instead of `grep` for opening
Diffstat (limited to 'bindings.bb')
| -rw-r--r-- | bindings.bb | 9 |
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 |
