On Friday, November 2, 2018 7:03 PM, Tinker <t1...@protonmail.ch> wrote: .. > > Try this one: bind -m '^L'=^Uclear'^J^Y' > > Thank you so much for coming up with this one. > > It does work as advertised - it clears the screen while keeping the > content and cursor position in the command line. > > I just realized that it does one inadvertent thing though: It adds a > line to ksh's history with the text "clear", which will surprise you > and unnecessarily steal some attention next time you press the up > arrow. > > I found this thread https://marc.info/?t=153299615600004&r=1&w=2 which > discusses how to get the "clear" out of the ksh history file, and, the > trick described there also applies to the history - great! > > So your suggestion above is amended with: > > bind -m '^L'=^U clear'^J^Y' > HISTCONTROL=ignorespace
Correction: bind -m '^L'='^U clear^J^Y' HISTCONTROL=ignorespace > I find the notion of using space prefix as ignore condition just a bit > primitive and with a very big risk of unintentional trigging, e.g., if > you paste a script in your shell its indentation would make it ignored. > > Could some other ^ shortcut be an ignore-this-line-from-history marker? > > ^I as in ignore, "bind -m '^L'=^U^Iclear'^J^Y'" :) > > Anyhow it works - great, thanks again for pointing out.