aboutsummaryrefslogtreecommitdiff
path: root/ksh/kshrc.d/bind.ksh
blob: 63b46162cfd98324c6511f7fac2748c304c6651f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Try to bind ^I to complete words and ^L to clear the screen
case $KSH_VERSION in

    # ksh93 is lovely, but complex; rebind ^L so it does the same as Alt-^L
    *'93'*)
        bind() {
            # shellcheck disable=SC2154
            case ${.sh.edchar} in
                $'\f') .sh.edchar=$'\e\f' ;;
            esac
        }
        trap bind KEYBD
        ;;

    # More straightforward with mksh; bind keys to the appropriate emacs mode
    # editing commands
    *'MIRBSD KSH'*)
        bind '^I'='complete'
        bind '^L'='clear-screen'
        ;;

    # Similar with pdksh; there's a "complete" command, but not a "clear" one,
    # so we fake it with clear(1) and some yanking
    *'PD KSH'*)
        bind '^I'='complete'
        bind -m '^L'='^Uclear^J^Y'
        ;;
esac