* how to revert tab completion order in _arguments or _describe
@ 2016-04-29 14:55 Paul Seyfert
0 siblings, 0 replies; 3+ messages in thread
From: Paul Seyfert @ 2016-04-29 14:55 UTC (permalink / raw)
To: Zsh Users
Hi,
I wrote a small tab completion function
(https://github.com/pseyfert/lb-zsh/blob/master/_lb-run) to complete the
command
```
lb-run Bender <some_version_number> <some executable command>
```
I defined this with
```
_arguments '-l[list versions]' '1:project:($projects)' '2:version:->listversions' '3:command:->runnablestuff'
case $state in
(runnablestuff)
### essentially _command_names -e
(listversions)
local -a versionlist
# lb-dev -l querries for existing version numbers
versionlist=($(lb-dev -l $line[1] | sed "s/ .*//" ))
# versionlist is now a list of existing version numbers
_describe 'project versions' versionlist
;;
esac
```
It reasonably works:
```
pseyfert@computer ~ > lb-run Bender v2<tab>
project versions:
v25r5p1 v25r7p3 v26r0 v26r2p1 v26r3p1 v27r0p1
v25r7p2 v25r7p4 v26r1 v26r3 v27r0 v28r0
```
One drawback though is that I'm usually most interested in the latest
version number but the menu completion starts with the oldest version
number (i think it's alphabetically ordered). Is there a way to tell the
_describe in the (listversions) state to cycle through the options in a
specific order? (actually i'm not bound to stick to _describe there, any
other function would be fine, too)
Thanks in advance,
Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to revert tab completion order in _arguments or _describe
2016-04-30 0:46 ` Daniel Shahaf
@ 2016-04-30 12:20 ` Paul Seyfert
0 siblings, 0 replies; 3+ messages in thread
From: Paul Seyfert @ 2016-04-30 12:20 UTC (permalink / raw)
To: Daniel Shahaf; +Cc: Zsh Users
On 30.04.2016 02:46, Daniel Shahaf wrote:
> Paul Seyfert wrote on Fri, Apr 29, 2016 at 16:55:57 +0200:
>> One drawback though is that I'm usually most interested in the latest
>> version number but the menu completion starts with the oldest version
>> number (i think it's alphabetically ordered). Is there a way to tell the
>> _describe in the (listversions) state to cycle through the options in a
>> specific order? (actually i'm not bound to stick to _describe there, any
>> other function would be fine, too)
>
> Yes. The option to show completions in the order given is either -J or
> -V (I don't remember which); both of them are documented under the
> 'compadd' builtin.
>
Thanks for the pointer,
-V keeps the original order (and then I realised that the original list
wasn't fully sorted so I added a `sort -r` to the pipe)
https://github.com/pseyfert/lb-zsh/commit/8e77312b6e69eb53acf4d6035a77e3ef3420f38b
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to revert tab completion order in _arguments or _describe
[not found] <572375FD.80200__31649.435326881$1461944191$gmane$org@mathphys.fsk.uni-heidelberg.de>
@ 2016-04-30 0:46 ` Daniel Shahaf
2016-04-30 12:20 ` Paul Seyfert
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Shahaf @ 2016-04-30 0:46 UTC (permalink / raw)
To: Paul Seyfert; +Cc: Zsh Users
Paul Seyfert wrote on Fri, Apr 29, 2016 at 16:55:57 +0200:
> One drawback though is that I'm usually most interested in the latest
> version number but the menu completion starts with the oldest version
> number (i think it's alphabetically ordered). Is there a way to tell the
> _describe in the (listversions) state to cycle through the options in a
> specific order? (actually i'm not bound to stick to _describe there, any
> other function would be fine, too)
Yes. The option to show completions in the order given is either -J or
-V (I don't remember which); both of them are documented under the
'compadd' builtin.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-30 12:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29 14:55 how to revert tab completion order in _arguments or _describe Paul Seyfert
[not found] <572375FD.80200__31649.435326881$1461944191$gmane$org@mathphys.fsk.uni-heidelberg.de>
2016-04-30 0:46 ` Daniel Shahaf
2016-04-30 12:20 ` Paul Seyfert
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).