From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7181 invoked from network); 15 Feb 2005 17:36:20 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Feb 2005 17:36:20 -0000 Received: (qmail 45426 invoked from network); 15 Feb 2005 17:36:15 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Feb 2005 17:36:15 -0000 Received: (qmail 5485 invoked by alias); 15 Feb 2005 17:36:08 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8510 Received: (qmail 5470 invoked from network); 15 Feb 2005 17:36:07 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Feb 2005 17:36:07 -0000 Received: (qmail 44329 invoked from network); 15 Feb 2005 17:36:04 -0000 Received: from caly80.spider.com (HELO bifrost.spider.com) (194.217.109.12) by a.mx.sunsite.dk with SMTP; 15 Feb 2005 17:36:00 -0000 Received: from no.name.available by bifrost.spider.com via smtpd (for thor.dotsrc.org [130.225.247.86]) with SMTP; 15 Feb 2005 17:36:00 UT Received: from heimdall-dmz.spider.com (mailhub.spider.com [212.240.99.13]) by caly80.spider.com (Postfix) with SMTP id E0DC76F43 for ; Tue, 15 Feb 2005 17:35:59 +0000 (GMT) Received: from mailhub.spider.com by heimdall-dmz.spider.com via smtpd (for [172.16.254.22]) with SMTP; 15 Feb 2005 17:35:59 UT Received: from localhost (duey.spider.com [212.240.99.128]) by batistuta.spider.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 1RT741A1; Tue, 15 Feb 2005 17:32:39 -0000 Date: Tue, 15 Feb 2005 17:35:58 +0000 From: Stephane Chazelas To: Zsh users list Subject: Re: vared in scripts and history Message-ID: <20050215173558.GB20729@duey.spider.com> Mail-Followup-To: Zsh users list References: <20050215131935.GA21734@duey.spider.com> <1050215162654.ZM7648@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1050215162654.ZM7648@candle.brasslantern.com> User-Agent: Mutt/1.5.7i X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Tue, Feb 15, 2005 at 04:26:54PM +0000, Bart Schaefer wrote: > On Feb 15, 1:19pm, Stephane Chazelas wrote: > } Subject: vared in scripts and history > } > } while a=; vared -p "$2" -e a; do > } > } Now, I'd like to add some history support. But I couldn't have it to > } work. Is there any way? > > With 4.2.3: > > fc -p -a $HOME/.zfhistory 10 10 > while a=; vared -h -p "$2" -e a; do > { ... } < $1 > print -s "${(P)2}" > done Thanks, that was the "print -s" I was looking for. I thought vared would insert the line by itself in the history list. Here is what I have, it replaces the terminal line editor (that only supports , , with zsh line editor (which supports arrows, Ctrl-A, history... no need for readline anymore): #! /usr/bin/env zsh trap 'printf "\03"; exit' INT HISTSIZE=100 while a=; vared -p "$2" -eh a; do { s=$(stty -g) stty -echo -iexten -isig lnext '' werase '' eof '' rprnt '' kill '' printf "%s\r" "$a" print -rs -- "$a" stty "$s" } < $1 done printf "\04" To be run as a :exec filter withing screen (with .!. as first argument to exec and "$(tty)" as first argument to the script. -- Stephane