diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-01-06 20:10:01 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-01-06 20:10:01 +1300 |
commit | 94331ff4049628e696d733420232d5b0cfef1919 (patch) | |
tree | 960c8ee85e03183022eb54e236745d4126fd1322 /ksh | |
parent | Merge branch 'master' into port/bsd/netbsd (diff) | |
parent | Rename keyboard trap func less ambiguously (diff) | |
download | dotfiles-94331ff4049628e696d733420232d5b0cfef1919.tar.gz dotfiles-94331ff4049628e696d733420232d5b0cfef1919.zip |
Merge branch 'master' into port/bsd/netbsd
Diffstat (limited to 'ksh')
-rw-r--r-- | ksh/kshrc | 16 | ||||
-rw-r--r-- | ksh/kshrc.d/bind.ksh | 28 |
2 files changed, 43 insertions, 1 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 |