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

Re: new completion modifications



Bart Schaefer wrote:

> On Mar 23,  2:16pm, Peter Stephenson wrote:
> } Subject: Re: new completion modifications
> }
> } Sven wrote:
> } > This seems reasonable.  Question to everyone (and -workers in
> } > particular): should we add a `urls' style, comparable to `hosts' and
> } > such, that just gives a bunch of strings to complete as urls?
> } > Probably taking precedence over the other things (different from
> } > `hosts' and friends).
> } 
> } Something like this.
> 
> That, and/or a flat file of URLs rather than a directory structure.  Hmm,
> we could have the following styles for the `urls' tag:
> 
> 	file	-- flat file containing URLs to complete (new?)
> 	local	-- prefixes for completing local URLs (exists now)
> 	path	-- location of directory tree mapping URLs (exists)
> 	urls	-- array of URLs to complete (new?)
> 
> I'm not sure about the names "file" and "path", but ...

Hmhm.

> } I don't know if it's going to be a problem with it always taking
> } precedence, however; one of these simple ones can then mask any of the
> } other sort if you just type a fairly generic prefix.
> 
> I don't think that's a problem because the tag is always `urls'; they'd
> just be in different groups.  Am I confused?

With the same tag (or without using group-names) they'd be in the same 
group.  But of course we can also make the other things take
precedence or give them all the same precedence so that users who use
more than one mechanism see all of them at the same time.  And of
course we can use different tags leaving it to the user's tag-order
setting.

> } (Does anyone else use _next_tags?)
> 
> I have, but rarely.

I have sometimes, too.  I need to remember it more often...


Oliver Kiddle wrote:

> Sven Wischnowsky wrote:
> > 
> > This seems reasonable.  Question to everyone (and -workers in
> > particular): should we add a `urls' style, comparable to `hosts' and
> > such, that just gives a bunch of strings to complete as urls?
> > Probably taking precedence over the other things (different from
> > `hosts' and friends).
> 
> I would prefer it if we could come up with a more general solution to
> this issue - I've seen other places where I've done repeated tabs. Also,
> the behaviour would be useful if the local style is the only one used
> for urls.

The problem I have with the current way to specify URLs is not the
repeated tabs, it's that it much more complicated to set up then
needed (for some, like the original poster).

> Is there maybe a way that you could get the completion system to have
> another go at completion straight away if it has just inserted a string
> unambigously. This could avoid the repeated tab situations. It would
> have to be configurable to only work in specific contexts with a style .
> This could be used in other cases.

But anyway, this is a good idea.  I know I thought about this some
time ago and thought I mentioned it here (but I'm not sure).

The problem is to find out when to stop.  And that the only way to
implement it I can currently see is some kind of wrapper around
_main_complete.  Although that could be just another widget, that
might be bound to TAB.

Hm.  Something as simple as:

    zle -N frob

    frob() {
      zle complete-word
      while [[ $_lastcomp[nmatches] -eq 1 && $RBUFFER[-1] != [[:blank:]] ]]; do
        zle complete-word
      done
    }

already does part of it, though not nicely.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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