Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Calling a zle widget from a function


I am trying to write a function that clears the screen every so many seconds. I asked for some help in #zsh, and thanks to curalton and ft I came up with:

precmd() {

	print "Clearing screen..."
	unset TMOUT

This works, but clear(1) is too obtrusive to be useful, as it will clear
anything that I've got on my command line.

So I would love to be able to call zle's clear-screen widget from the function.

redondos@refinery ~ % zle clear-screen
zle: widgets can only be called when ZLE is active

I am not fully aware of how zle works, and how (if possible) I would make it
active. It looks like the zle builtin only accepts a widget if it is called
from within another widget, and not on the command line.

Any workarounds for this, or any other way of clearing the screen more
efficient and unobtrusively?

Thanks in advance.


Attachment: pgpM3wxZ3dxXn.pgp
Description: PGP signature

Messages sorted by: Reverse Date, Date, Thread, Author