diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-01-06 19:35:18 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-01-06 19:35:18 +1300 |
commit | de6ec20aec4af67f8de5ab94b76f43722c8e655f (patch) | |
tree | 197cf4588fc30e034fd070d154d8476c79b789f4 /ksh | |
parent | Experimental/not-very-good-yet ksh bindings (diff) | |
download | dotfiles-de6ec20aec4af67f8de5ab94b76f43722c8e655f.tar.gz dotfiles-de6ec20aec4af67f8de5ab94b76f43722c8e655f.zip |
Clean binding of ^L in ksh93 to clear screen
<http://unix.stackexchange.com/questions/272591/how-to-make-ctrl-l-to-clear-screen-in-ksh-under-red-hat-linux/272720#272720>
Diffstat (limited to 'ksh')
-rw-r--r-- | ksh/kshrc.d/bind.ksh | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/ksh/kshrc.d/bind.ksh b/ksh/kshrc.d/bind.ksh index 22fb53a8..e32b9565 100644 --- a/ksh/kshrc.d/bind.ksh +++ b/ksh/kshrc.d/bind.ksh @@ -6,29 +6,18 @@ case $KSH_VERSION in bind ^L=clear-screen ;; - # Works pretty well, but only on an empty line - *'PD KSH'*) - bind -m '^L'=clear'^J' - ;; - - # Not great; only works on an empty line, and skips a line after clearing; - # need a better way to redraw the prompt after clearing, or some suitable - # way to fake it with tput (can I clear-but-one)? + # Works great *'93'*) - - # Bind function to run on each KEYBD trap bind() { case ${.sh.edchar} in - $'\x0c') # ^L - - # Write a sequence to clear the screen - tput clear - - # Change key to Enter to redraw the prompt - .sh.edchar=$'\x0d' - ;; + $'\f') .sh.edchar=$'\e\f' ;; esac } trap bind KEYBD ;; + + # Works pretty well, but only on an empty line + *'PD KSH'*) + bind -m '^L'=clear'^J' + ;; esac |