Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
how to revert tab completion order in _arguments or _describe
- X-seq: zsh-users 21505
- From: Paul Seyfert <pseyfert@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: how to revert tab completion order in _arguments or _describe
- Date: Fri, 29 Apr 2016 16:55:57 +0200
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author