2019-09-30 15:46:24 -07:00
|
|
|
#!/bin/sh
|
|
|
|
# This file contains the script that is run when bb launches
|
2019-11-11 12:29:40 -08:00
|
|
|
# See API.md for details on bb's command API.
|
2019-09-30 15:46:24 -07:00
|
|
|
|
|
|
|
# Load key bindings
|
|
|
|
# first check ~/.config/bb/bindings.bb, then /etc/xdg/bb/bindings.bb, then ./bindings.bb
|
2019-11-06 08:22:12 -08:00
|
|
|
if [ ! -e "$XDG_CONFIG_HOME/bb/bindings.bb" ] && [ ! -e "$sysconfdir/xdg/bb/bindings.bb" ]; then
|
2019-11-24 21:28:46 -08:00
|
|
|
cat "./bindings.bb" 2>/dev/null | sed -e '/^#/d' -e "s/^\([^ ]\)/$(printf '\034')bind:\\1/" | tr '\034' '\0' >> "$BBCMD"
|
2019-11-06 08:22:12 -08:00
|
|
|
else
|
|
|
|
for path in "$sysconfdir/xdg/bb" "$XDG_CONFIG_HOME/bb"; do
|
|
|
|
cat "$path/bindings.bb" 2>/dev/null
|
2019-11-24 21:28:46 -08:00
|
|
|
done | sed -e '/^#/d' -e "s/^\([^ ]\)/$(printf '\034')bind:\\1/" | tr '\034' '\0' >> "$BBCMD"
|
2019-11-06 08:22:12 -08:00
|
|
|
fi
|
2019-10-03 13:24:52 -07:00
|
|
|
printf '\0' >> "$BBCMD"
|