* Clearing command line after some time?
@ 2005-12-02 9:43 Anssi Saari
2005-12-02 10:46 ` Peter Stephenson
0 siblings, 1 reply; 2+ messages in thread
From: Anssi Saari @ 2005-12-02 9:43 UTC (permalink / raw)
To: zsh-users
I have this nasty habit of sometimes typing something on the command
line and then forgetting about it, due to interruptions. Usually it's
no problem, but if I happened to type in be rm, well, annoying things
can happen. (And no, I'm not looking for a discussion about aliasing rm).
Anyway, I figured that zsh can save me from this sort of thing and came
up with
trap '[[ $TTYIDLE -gt 60 ]] && [[ $#BUFFER -gt 0 ]] && zle kill-buffer && zle -I' ALRM
TMOUT=5
as a first draft. It seems to work, but I'd really like to insert the
stuff from the command line to command history instead of the kill
buffer. But I couldn't figure out how to do that?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Clearing command line after some time?
2005-12-02 9:43 Clearing command line after some time? Anssi Saari
@ 2005-12-02 10:46 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2005-12-02 10:46 UTC (permalink / raw)
To: zsh-users
Anssi Saari <as@sci.fi> wrote:
> It seems to work, but I'd really like to insert the
> stuff from the command line to command history instead of the kill
> buffer. But I couldn't figure out how to do that?
trap '[[ $TTYIDLE -gt 60 $#BUFFER -gt 0 ]] &&
print -sr $BUFFER && zle kill-buffer && zle -I' ALRM
"print -s" does that. The additional -r keeps backslashes under control.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-12-02 10:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-02 9:43 Clearing command line after some time? Anssi Saari
2005-12-02 10:46 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).