Cleanup of binding loading code

This commit is contained in:
Bruce Hill 2020-02-24 02:59:04 -08:00
parent 1dbece8b2e
commit 9d9ad35bde

View File

@ -2,15 +2,14 @@
# This file contains the script that is run when bb launches
# See API.md for details on bb's command API.
# Load key bindings
# first check ~/.config/bb/bindings.bb, then /etc/xdg/bb/bindings.bb, then ./bindings.bb
[ ! -d "$XDG_DATA_HOME/bb" ] && mkdir -p "$XDG_DATA_HOME/bb"
# Load key bindings
if [ "$BBPATH" ]; then
cat "$BBPATH/bindings.bb" 2>/dev/null
cat "$BBPATH/bindings.bb" "$XDG_CONFIG_HOME/bb/bindings.bb"
else
cat "$sysconfdir/xdg/bb/bindings.bb" "$XDG_CONFIG_HOME/bb/bindings.bb" 2>/dev/null
fi | awk '/^#/ {next} /^[^ ]/ {printf "\0bind:"} {print $0} END {printf "\0"}' >> "$BBCMD"
cat "$sysconfdir/xdg/bb/bindings.bb" "$XDG_CONFIG_HOME/bb/bindings.bb"
fi 2>/dev/null | awk '/^#/ {next} /^[^ ]/ {printf "\0bind:"} {print $0} END {printf "\0"}' >> "$BBCMD"
if [ -e "$XDG_DATA_HOME/bb/state.sh" ]; then
. "$XDG_DATA_HOME/bb/state.sh"