Red Hat provides "ksh-93", which does not have a bind command. It provides something called KEYBD, which is triggered via a special trap function. According to the manual page, that can be used to modify the Emacs Editing Mode.
The example at [Korn Shell] Fixing Home, End, pgup, pgdown, and delete keys is a useful starting point for showing how to make ^L clear the screen. By default, metacontrolL (^[^L) is bound to the clear-screen function, while plain ^L is just the next-line which you would like to change:
^L Line feed and print current line.
M-^L Clear the screen.
Adding just one line to the example does what was asked:
set -o emacs
keybd_trap () {
case ${.sh.edchar} in
$'\f') .sh.edchar=$'\e\f';; # clear-screen (THIS QUESTION)
$'\e[1~') .sh.edchar=$'\001';; # Home = beginning-of-line
$'\e[4~') .sh.edchar=$'\005';; # End = end-of-line
$'\e[5~') .sh.edchar=$'\e>';; # PgUp = history-previous
$'\e[6~') .sh.edchar=$'\e<';; # PgDn = history-next
$'\e[3~') .sh.edchar=$'\004';; # Delete = delete-char
esac
}
trap keybd_trap KEYBD
For whatever reason, vi-mode is far less capable in ksh.
The documentation is vague on how keys are actually mapped to functions. For this instance the feature is implemented in src/cmd/ksh93/edit/emacs.c as part of a switch/case statement:
#ifdef _cmd_tput
case cntl('L'): /* clear screen */
sh_trap("tput clear", 0);
draw(ep,REFRESH);
return(-1);
#endif
within the escape function (i.e., handling "meta"). So it is built-in behavior that can be customizedksh.
Further reading:
Q4. How is keybinding done?
A4. ksh93 provides a KEYBD trap that gets executed whenever a key
is entered from the keyboard. Using this trap, and the associate
array feature of ksh93, a keybind function can easily be written
which will map any entered key sequence to another key sequence.