~ubuntu-branches/debian/wheezy/byobu/wheezy

« back to all changes in this revision

Viewing changes to usr/bin/byobu-ctrl-a

  • Committer: Package Import Robot
  • Author(s): Alexander Chernyakhovsky
  • Date: 2012-01-11 19:37:34 UTC
  • mfrom: (0.5.3) (0.1.162 precise)
  • Revision ID: package-import@ubuntu.com-20120111193734-89083z97py39gj05
Tags: 5.2-1
* Syncing from Ubuntu. Remaining changes:
  - Switch to dh short syntax
  - Added a substvar ${perl:Depends} dependency into debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
}
27
27
 
28
28
PKG="byobu"
 
29
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
29
30
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
30
 
. "${BYOBU_PREFIX}/lib/${PKG}/.common"
 
31
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
31
32
 
32
33
bind_to=""
33
34
keybindings="$BYOBU_CONFIG_DIR/keybindings"
46
47
        echo "Configure Byobu's ctrl-a behavior..."
47
48
        echo
48
49
        echo "When you press ctrl-a in Byobu, do you want it to operate in:"
49
 
        echo "    (1) Emacs mode  (go to beginning of line)"
50
 
        echo "    (2) Screen mode (GNU Screen's default escape sequence)"
 
50
        echo "    (1) Screen mode (GNU Screen's default escape sequence)"
 
51
        echo "    (2) Emacs mode  (go to beginning of line)"
51
52
        echo
52
53
        echo "Note that:"
53
54
        echo "  - F12 also operates as Screen escape in Byobu"
54
55
        echo "  - You can press F9 and choose your escape character"
55
56
        echo "  - You can run 'byobu-ctrl-a' at any time to change your selection"
56
57
        echo
57
 
        echo -n "Select [1 or 2]: "
 
58
        printf "Select [1 or 2]: "
58
59
        s=$(head -n1)
59
60
        echo
60
61
        case "$s" in
61
 
                1) bind_to="emacs"; break;;
62
 
                2) bind_to="screen"; break;;
 
62
                1) bind_to="screen"; break;;
 
63
                2) bind_to="emacs"; break;;
63
64
        esac
64
65
done
65
66
 
66
67
case "$bind_to" in
67
68
        emacs)
68
 
                        $SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
69
 
                        echo 'bindkey "^A"' >> "$keybindings"
70
 
                        echo "INFO: ctrl-a will now operate in emacs mode"
71
 
                        ;;
72
 
        screen)
73
 
                        $SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
74
 
                        echo 'escape "^Aa"' >> "$keybindings"
75
 
                        echo 'register x "^A"' >> "$keybindings"
76
 
                        echo 'bindkey "^A"' >> "$keybindings"
77
 
                        echo "INFO: ctrl-a will now operate in GNU Screen mode"
78
 
                        break
79
 
                ;;
80
 
        *) echo "Error: bad value for binding: $bind_to";;
81
 
esac
82
 
 
83
 
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
 
69
                $SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
 
70
                echo 'bindkey "^A"' >> "$keybindings"
 
71
                echo "INFO: ctrl-a will now operate in emacs mode"
 
72
                echo > "$keybindings.tmux"
 
73
        ;;
 
74
        screen)
 
75
                $SED -i -e "/^register a /d" -e "/^bindkey \"^A\"/d" -e "/^escape /d" "$keybindings"
 
76
                echo 'escape "^Aa"' >> "$keybindings"
 
77
                echo 'register x "^A"' >> "$keybindings"
 
78
                echo 'bindkey "^A"' >> "$keybindings"
 
79
                echo "source /usr/share/doc/tmux/examples/screen-keys.conf" > "$keybindings.tmux"
 
80
                echo "INFO: ctrl-a will now operate in GNU Screen mode"
 
81
                break
 
82
        ;;
 
83
        *)
 
84
                echo "Error: bad value for binding: $bind_to"
 
85
        ;;
 
86
esac
 
87
 
 
88
case "$BYOBU_BACKEND" in
 
89
        screen)
 
90
                $BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
 
91
        ;;
 
92
esac
 
93
 
84
94
echo "To modify this behavior again later, run 'byobu-ctrl-a'"
85
95
echo
86
96