diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-01-06 20:08:59 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-01-06 20:08:59 +1300 |
commit | c167cffcbdad7c8c87801965ec0c68a885a88daf (patch) | |
tree | 960c8ee85e03183022eb54e236745d4126fd1322 /ksh | |
parent | Merge branch 'master' into port/bsd/openbsd (diff) | |
parent | Rename keyboard trap func less ambiguously (diff) | |
download | dotfiles-c167cffcbdad7c8c87801965ec0c68a885a88daf.tar.gz dotfiles-c167cffcbdad7c8c87801965ec0c68a885a88daf.zip |
Merge branch 'master' into port/bsd/openbsd
Diffstat (limited to 'ksh')
-rw-r--r-- | ksh/kshrc | 16 | ||||
-rw-r--r-- | ksh/kshrc.d/bind.ksh | 28 | ||||
-rw-r--r-- | ksh/kshrc.d/keep.ksh | 1 |
3 files changed, 43 insertions, 2 deletions
@@ -1,7 +1,21 @@ -# Emacs-style key bindings +# Emacs-style key bindings; these are present in ksh88 and pdksh set -o braceexpand set -o emacs +# Track locations of binaries +set -o trackall + +# Use subshells to test these newer options, as ksh93 seems to get very upset +# if you try to set an option and it doesn't exist + +# Try to get "**" as a recursive glob +(set -o globstar) 2>/dev/null && + set -o globstar + +# Try to get !-style history expansion +(set -o histexpand) 2>/dev/null && + set -o histexpand + # Save history HISTFILE=$HOME/.ksh_history HISTSIZE=$((1 << 10)) diff --git a/ksh/kshrc.d/bind.ksh b/ksh/kshrc.d/bind.ksh new file mode 100644 index 00000000..34cb5f5a --- /dev/null +++ b/ksh/kshrc.d/bind.ksh @@ -0,0 +1,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'*) + keybd_trap() { + # shellcheck disable=SC2154 + case ${.sh.edchar} in + $'\f') .sh.edchar=$'\e\f' ;; + esac + } + trap keybd_trap 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 diff --git a/ksh/kshrc.d/keep.ksh b/ksh/kshrc.d/keep.ksh index c57c41ce..0451fa68 100644 --- a/ksh/kshrc.d/keep.ksh +++ b/ksh/kshrc.d/keep.ksh @@ -142,7 +142,6 @@ EOF # Otherwise the user must want us to print all the NAMEs kept ( - typeset keep for keep in "$kshkeep"/*.ksh ; do [[ -f "$keep" ]] || break keep=${keep##*/} |