* usr/bin/byobu-ctrl-a, usr/share/byobu/profiles/tmux: LP: #887387

- support F12 as escape key in tmux mode
  - reorder byobu-ctrl-a to offer screen first, then emacs mode
  - make byobu-ctrl-a slighty more compatible with tmux (not quite
    there yet...)
This commit is contained in:
Dustin Kirkland 2011-11-08 18:12:50 -06:00
commit 794b471b5c
3 changed files with 34 additions and 17 deletions

5
debian/changelog vendored
View file

@ -15,6 +15,11 @@ byobu (4.46) unreleased; urgency=low
usr/share/byobu/profiles/tmux: LP: #883637
- fix reconnection to SESSION_MANAGER and DBUS_SESSION_BUS_ADDRESS
- add C-F5 key to tmux profile
* usr/bin/byobu-ctrl-a, usr/share/byobu/profiles/tmux: LP: #887387
- support F12 as escape key in tmux mode
- reorder byobu-ctrl-a to offer screen first, then emacs mode
- make byobu-ctrl-a slighty more compatible with tmux (not quite
there yet...)
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 31 Oct 2011 09:46:46 -0400

View file

@ -46,8 +46,8 @@ while [ -z "$bind_to" ]; do
echo "Configure Byobu's ctrl-a behavior..."
echo
echo "When you press ctrl-a in Byobu, do you want it to operate in:"
echo " (1) Emacs mode (go to beginning of line)"
echo " (2) Screen mode (GNU Screen's default escape sequence)"
echo " (1) Screen mode (GNU Screen's default escape sequence)"
echo " (2) Emacs mode (go to beginning of line)"
echo
echo "Note that:"
echo " - F12 also operates as Screen escape in Byobu"
@ -58,29 +58,38 @@ while [ -z "$bind_to" ]; do
s=$(head -n1)
echo
case "$s" in
1) bind_to="emacs"; break;;
2) bind_to="screen"; break;;
1) bind_to="screen"; break;;
2) bind_to="emacs"; break;;
esac
done
case "$bind_to" in
emacs)
$SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
echo 'bindkey "^A"' >> "$keybindings"
echo "INFO: ctrl-a will now operate in emacs mode"
;;
$SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
echo 'bindkey "^A"' >> "$keybindings"
echo "INFO: ctrl-a will now operate in emacs mode"
echo > "$keybindings.tmux"
;;
screen)
$SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
echo 'escape "^Aa"' >> "$keybindings"
echo 'register x "^A"' >> "$keybindings"
echo 'bindkey "^A"' >> "$keybindings"
echo "INFO: ctrl-a will now operate in GNU Screen mode"
break
;;
*) echo "Error: bad value for binding: $bind_to";;
$SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
echo 'escape "^Aa"' >> "$keybindings"
echo 'register x "^A"' >> "$keybindings"
echo 'bindkey "^A"' >> "$keybindings"
echo 'source /usr/share/doc/tmux/examples/screen-keys.conf' > "$keybindings.tmux"
echo "INFO: ctrl-a will now operate in GNU Screen mode"
break
;;
*)
echo "Error: bad value for binding: $bind_to"
;;
esac
case "$BYOBU_BACKEND" in
screen)
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
;;
esac
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
echo "To modify this behavior again later, run 'byobu-ctrl-a'"
echo

View file

@ -30,6 +30,9 @@ source /usr/share/doc/tmux/examples/screen-keys.conf
# On Archlinux, this file is not under the same directory
source /usr/share/tmux/screen-keys.conf
# Add F12 to the prefix list
set -g prefix ^A,F12
# Byobu's Keybindings
bind-key -n F1 new-window -k -t config byobu-config
bind-key -n F2 new-window