From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8579 invoked from network); 14 Sep 1997 17:35:31 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 14 Sep 1997 17:35:31 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id NAA08576; Sun, 14 Sep 1997 13:30:04 -0400 (EDT) Resent-Date: Sun, 14 Sep 1997 13:29:43 -0400 (EDT) Message-ID: <19970914102839.45957@sco.com> Date: Sun, 14 Sep 1997 10:28:39 -0700 From: "Adam R. Paul" To: zsh Subject: Re: multiple background jobs of the same program References: <9709140326.AA21133@cryptica.UCSD.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.81 In-Reply-To: <9709140326.AA21133@cryptica.UCSD.EDU>; from Jose Unpingco on Sat, Sep 13, 1997 at 08:26:46PM -0700 Resent-Message-ID: <"ZYznZ2.0.H52.6y17q"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1017 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu It would appear that on Sat, Sep 13, 1997 at 08:26:46PM -0700, Jose Unpingco wrote: > Hi, > > I often have multiple vi edit sessions going. When I do the completion > for fg (fg -j -P % +) that shuffles through the list of jobs, I only > get the name of the program, i.e. vi, which is not very helpful since > there are multiple vi sessions going. One way around this is to refer > to the jobs using the job number. > > Anybody have any suggestions? I'd really like to use the completion > for fg more productively. I've often wanted the same thing - I just cooked up a compctl that _almost_ works: setopt interactive_comments listjobs() { jobs > /tmp/._zshjobcomp.$$ 2>&1 set -A reply OIFS="$IFS" IFS=' ' reply=( $(sed -e '{ s/.\(....\).............\(.*\)/\1 # \2/g s/\]//g s/ */ /g }' /tmp/._zshjobcomp.$$) ) IFS="$OIFS" } compctl -P % -K listjobs fg The only problem is that zsh is escaping the spaces & #'s that result from the completion, which looks really ugly. Also, I don't really want interactive_comments set all the time - just for this completion, but I haven't thought of any way to do this (yet:) Any improvements? I suspect that the sed bit could be replaced by some neato zsh internal parameter mangling stuff, but I confess I am not terribly handy with most of the zsh-specific parameter expansion/substitution features. _Adam ----- Adam R. Paul - adamp@sco.com SCO Engineering - #include Sfhacca. Opnchoiggotl allthouuthqu ut tzhuarlahqu tn'ogo khozhna oomgga.