zsh-users
 help / color / mirror / code / Atom feed
From: "Adam R. Paul" <adamp@sco.com>
To: zsh <zsh-users@math.gatech.edu>
Subject: Re: multiple background jobs of the same program
Date: Sun, 14 Sep 1997 10:28:39 -0700	[thread overview]
Message-ID: <19970914102839.45957@sco.com> (raw)
In-Reply-To: <9709140326.AA21133@cryptica.UCSD.EDU>; from Jose Unpingco on Sat, Sep 13, 1997 at 08:26:46PM -0700

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 <stddisclaimer.h>

Sfhacca.  Opnchoiggotl allthouuthqu ut tzhuarlahqu tn'ogo khozhna oomgga.  


  reply	other threads:[~1997-09-14 17:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-14  3:26 Jose Unpingco
1997-09-14 17:28 ` Adam R. Paul [this message]
1997-09-14 19:10   ` Bart Schaefer
1997-09-14 22:05     ` Adam R. Paul
1997-09-14 23:09       ` Bart Schaefer
1997-09-15  3:02         ` Adam R. Paul
     [not found]           ` <5len6q9692.fsf@tequila.systemsz.cs.yale.edu>
     [not found]             ` <5ld8ma95sf.fsf@tequila.systemsz.cs.yale.edu>
1997-09-15 14:56               ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19970914102839.45957@sco.com \
    --to=adamp@sco.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).