aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-10-09 17:28:59 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-10-09 17:28:59 -0700
commit4cc2bd59c3fcc877aab1a9060aa3e6d741b63f1a (patch)
tree6b9ac58c6cd4d510d7976c3c31eb5cb54ee15610
parent9a1599e728b3ff7cc32ece9a691876c9e0dde4e8 (diff)
Shortened loop to find bindings.
-rwxr-xr-xbbstartup.sh10
1 files changed, 3 insertions, 7 deletions
diff --git a/bbstartup.sh b/bbstartup.sh
index cb36d38..e46ef64 100755
--- a/bbstartup.sh
+++ b/bbstartup.sh
@@ -18,11 +18,7 @@ mark marks "$XDG_CONFIG_HOME/bb/marks"
# Load key bindings
# first check ~/.config/bb/bindings.bb, then /etc/xdg/bb/bindings.bb, then ./bindings.bb
-if [ -e "$XDG_CONFIG_HOME/bb/bindings.bb" ]; then
- cat "$XDG_CONFIG_HOME/bb/bindings.bb"
-elif [ -e "$sysconfdir/xdg/bb/bindings.bb" ]; then
- cat "$sysconfdir/xdg/bb/bindings.bb"
-elif [ -e bindings.bb ]; then
- cat bindings.bb
-fi | sed -e '/^#/d' -e "s/^[^ ]/$(printf '\034')+bind:\\0/" | tr '\034' '\0' >> "$BBCMD"
+for path in "$XDG_CONFIG_HOME/bb" "$sysconfdir/xdg/bb" "."; do
+ cat "$path/bindings.bb" 2>/dev/null && break
+done | sed -e '/^#/d' -e "s/^[^ ]/$(printf '\034')+bind:\\0/" | tr '\034' '\0' >> "$BBCMD"
printf '\0' >> "$BBCMD"