mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
* usr/bin/byobu-ctrl-a, usr/share/byobu/keybindings/f-keys.tmux,
usr/share/byobu/keybindings/f-keys.tmux.disable, usr/share/byobu/profiles/tmuxrc: LP: #923134 - get byobu-ctrl-a working within tmux, like screen - prompt the user for ctrl-a to work in Screen/escape mode, or emacs mode
This commit is contained in:
parent
067aabab6e
commit
9d6f74db73
5 changed files with 43 additions and 21 deletions
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -3,6 +3,12 @@ byobu (5.9) unreleased; urgency=low
|
||||||
* usr/bin/byobu-status:
|
* usr/bin/byobu-status:
|
||||||
- fix broken status expiration, which wasn't working and probably
|
- fix broken status expiration, which wasn't working and probably
|
||||||
had a huge performance penalty :-(
|
had a huge performance penalty :-(
|
||||||
|
* usr/bin/byobu-ctrl-a, usr/share/byobu/keybindings/f-keys.tmux,
|
||||||
|
usr/share/byobu/keybindings/f-keys.tmux.disable,
|
||||||
|
usr/share/byobu/profiles/tmuxrc: LP: #923134
|
||||||
|
- get byobu-ctrl-a working within tmux, like screen
|
||||||
|
- prompt the user for ctrl-a to work in Screen/escape mode, or emacs
|
||||||
|
mode
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 12 Feb 2012 10:01:36 -0600
|
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 12 Feb 2012 10:01:36 -0600
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ PKG="byobu"
|
||||||
|
|
||||||
bind_to=""
|
bind_to=""
|
||||||
keybindings="$BYOBU_CONFIG_DIR/keybindings"
|
keybindings="$BYOBU_CONFIG_DIR/keybindings"
|
||||||
|
[ "$BYOBU_BACKEND" = "tmux" ] && keybindings="$keybindings.tmux"
|
||||||
touch "$keybindings"
|
touch "$keybindings"
|
||||||
|
|
||||||
# If the user has already chosen an escape sequence, then
|
# If the user has already chosen an escape sequence, then
|
||||||
|
@ -43,7 +44,7 @@ case "${1}" in
|
||||||
screen) bind_to="screen";;
|
screen) bind_to="screen";;
|
||||||
emacs) bind_to="emacs";;
|
emacs) bind_to="emacs";;
|
||||||
"") :;;
|
"") :;;
|
||||||
*) { Usage echo "bad argument $1"; } 1>&2; exit 1;;
|
*) { Usage printf "%s\n" "Bad argument $1"; } 1>&2; exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
while [ -z "$bind_to" ]; do
|
while [ -z "$bind_to" ]; do
|
||||||
|
@ -55,7 +56,7 @@ while [ -z "$bind_to" ]; do
|
||||||
echo " (2) Emacs mode (go to beginning of line)"
|
echo " (2) Emacs mode (go to beginning of line)"
|
||||||
echo
|
echo
|
||||||
echo "Note that:"
|
echo "Note that:"
|
||||||
echo " - F12 also operates as Screen escape in Byobu"
|
echo " - F12 also operates as an escape in Byobu"
|
||||||
echo " - You can press F9 and choose your escape character"
|
echo " - You can press F9 and choose your escape character"
|
||||||
echo " - You can run 'byobu-ctrl-a' at any time to change your selection"
|
echo " - You can run 'byobu-ctrl-a' at any time to change your selection"
|
||||||
echo
|
echo
|
||||||
|
@ -70,34 +71,45 @@ done
|
||||||
|
|
||||||
case "$bind_to" in
|
case "$bind_to" in
|
||||||
emacs)
|
emacs)
|
||||||
$BYOBU_SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape escape \^Aa/d" "$keybindings"
|
case "$BYOBU_BACKEND" in
|
||||||
echo 'bindkey "^A"' >> "$keybindings"
|
screen)
|
||||||
|
$BYOBU_SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape escape \^Aa/d" "$keybindings"
|
||||||
|
echo 'bindkey "^A"' >> "$keybindings"
|
||||||
|
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||||
|
;;
|
||||||
|
tmux)
|
||||||
|
$BYOBU_SED -i -e "/^set -g prefix /d" -e "/ send-prefix/d" -e "/^unbind-key -n C-a/d" "$keybindings"
|
||||||
|
echo "set -g prefix F12" >> "$keybindings"
|
||||||
|
echo "unbind-key -n C-a" >> "$keybindings"
|
||||||
|
$BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
echo "INFO: ctrl-a will now operate in emacs mode"
|
echo "INFO: ctrl-a will now operate in emacs mode"
|
||||||
echo > "$keybindings.tmux"
|
|
||||||
;;
|
;;
|
||||||
screen)
|
screen)
|
||||||
$BYOBU_SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
|
case "$BYOBU_BACKEND" in
|
||||||
echo 'escape "^Aa"' >> "$keybindings"
|
screen)
|
||||||
echo 'register x "^A"' >> "$keybindings"
|
$BYOBU_SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
|
||||||
echo 'bindkey "^A"' >> "$keybindings"
|
echo 'escape "^Aa"' >> "$keybindings"
|
||||||
echo "source /usr/share/doc/tmux/examples/screen-keys.conf" > "$keybindings.tmux"
|
echo 'register a "^A"' >> "$keybindings"
|
||||||
|
echo 'bindkey "^A"' >> "$keybindings"
|
||||||
|
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||||
|
;;
|
||||||
|
tmux)
|
||||||
|
$BYOBU_SED -i -e "/^set -g prefix /d" -e "/ send-prefix/d" -e "/^unbind-key -n C-a/d" "$keybindings"
|
||||||
|
echo "unbind-key -n C-a" >> "$keybindings"
|
||||||
|
echo "set -g prefix ^A,F12" >> "$keybindings"
|
||||||
|
echo "bind a send-prefix" >> "$keybindings"
|
||||||
|
$BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
echo "INFO: ctrl-a will now operate in GNU Screen mode"
|
echo "INFO: ctrl-a will now operate in GNU Screen mode"
|
||||||
break
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Error: bad value for binding: $bind_to"
|
echo "Error: bad value for binding: $bind_to"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$BYOBU_BACKEND" in
|
|
||||||
tmux)
|
|
||||||
true
|
|
||||||
;;
|
|
||||||
screen)
|
|
||||||
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "To modify this behavior again later, run 'byobu-ctrl-a'"
|
echo "To modify this behavior again later, run 'byobu-ctrl-a'"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Add F12 to the prefix list
|
# Add F12 to the prefix list
|
||||||
set -g prefix ^A,F12
|
set -g prefix F12
|
||||||
|
|
||||||
# Byobu's Keybindings
|
# Byobu's Keybindings
|
||||||
# Documented in: $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt
|
# Documented in: $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt
|
||||||
|
@ -70,3 +70,5 @@ bind-key -n S-F11 join-pane -v -s :. -t :-1
|
||||||
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux.disable
|
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux.disable
|
||||||
bind-key -n C-S-F12 new-window $BYOBU_PREFIX/lib/byobu/include/mondrian
|
bind-key -n C-S-F12 new-window $BYOBU_PREFIX/lib/byobu/include/mondrian
|
||||||
bind-key -n M-IC paste-buffer
|
bind-key -n M-IC paste-buffer
|
||||||
|
|
||||||
|
bind-key -n C-a new-window -n "ctrl-a" "byobu-ctrl-a"
|
||||||
|
|
|
@ -66,3 +66,4 @@ unbind-key -n S-F11
|
||||||
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux
|
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux
|
||||||
unbind-key -n C-S-F12
|
unbind-key -n C-S-F12
|
||||||
unbind-key -n M-IC
|
unbind-key -n M-IC
|
||||||
|
unbind-key -n C-a
|
||||||
|
|
|
@ -24,4 +24,5 @@
|
||||||
|
|
||||||
source-file $HOME/.byobu/color.tmux
|
source-file $HOME/.byobu/color.tmux
|
||||||
source-file $BYOBU_CONFIG_DIR/profile.tmux
|
source-file $BYOBU_CONFIG_DIR/profile.tmux
|
||||||
|
source-file $BYOBU_CONFIG_DIR/keybindings.tmux
|
||||||
source-file $HOME/.byoburc.tmux
|
source-file $HOME/.byoburc.tmux
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue