* compadd and an array parameter
@ 2004-10-26 16:59 DervishD
2004-10-27 15:06 ` DervishD
0 siblings, 1 reply; 2+ messages in thread
From: DervishD @ 2004-10-26 16:59 UTC (permalink / raw)
To: Zsh Users
Hi all :)
I'm playing (again) with the completion code, and I've written
something like this:
bindkey "^O" completer
zle -C completer expand-or-complete completer
function completer () {
[[ $compstate[context] = "command" ]] && compadd ${commands##*/}
return 0
}
Well, what I want is to complete using the contents of the
'commands' array, but with the path stripped, but I think that the
compadd command above will lead to a very big expansion. Can I tell
compadd something like 'compadd -a commands' and something more to
make it strip the path or the expansion above is the only way?
Of course, I could examine 'CURRENT', perform a match and include
only that match in the compadd command line, but I'm curious...
Thanks a lot in advance :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: compadd and an array parameter
2004-10-26 16:59 compadd and an array parameter DervishD
@ 2004-10-27 15:06 ` DervishD
0 siblings, 0 replies; 2+ messages in thread
From: DervishD @ 2004-10-27 15:06 UTC (permalink / raw)
To: Zsh Users
Hi all :)
My excuses again for self-replying...
* DervishD <zsh@dervishd.net> dixit:
[...]
> [[ $compstate[context] = "command" ]] && compadd ${commands##*/}
[...]
> Well, what I want is to complete using the contents of the
> 'commands' array, but with the path stripped, but I think that the
> compadd command above will lead to a very big expansion. Can I tell
> compadd something like 'compadd -a commands' and something more to
> make it strip the path or the expansion above is the only way?
Better 'compadd -k commands'. The keys of the 'commands'
associative array are the command names, without path. I don't know
what I was thinking...
Sorry for the noise. What a day...
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-27 15:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-26 16:59 compadd and an array parameter DervishD
2004-10-27 15:06 ` DervishD
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).