* Re: Completion for variable assigement
@ 2000-06-19 14:00 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-06-19 14:00 UTC (permalink / raw)
To: zsh-users
Bernd Eggink wrote:
> I'd like to have completion for assignements to a variable. So that,
> for example,
>
> PROJECT=<TAB>
>
> will allow me to cycle through all file names in the current directory
> ending with '.mak' (without the suffix). I succeeded in doing this only
> by wrapping the assignement in a function 'setp':
>
> function projects
> {
> reply=(*.mak) 2>/dev/null
> reply=(${reply%.mak})
> }
>
> function setp
> {
> PROJECT=$1
> }
>
> compctl -K projects setp
>
> Is there any way to avoid the wrapper function?
Uh, if I remember correctly, completion in assignments is hard-wired
for compctl.
Use the new completion system and:
_value:PROJECT() { _files -g '*.mak(:r)' -S ' ' }
or, if it accepts colon-separated lists of such files:
_value:PROJECT() { compset -P '*:'; _files -g '*.mak(:r)' -qS: }
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Completion for variable assigement
@ 2000-06-18 20:33 Bernd Eggink
0 siblings, 0 replies; 2+ messages in thread
From: Bernd Eggink @ 2000-06-18 20:33 UTC (permalink / raw)
To: Zsh Users
I'd like to have completion for assignements to a variable. So that,
for example,
PROJECT=<TAB>
will allow me to cycle through all file names in the current directory
ending with '.mak' (without the suffix). I succeeded in doing this only
by wrapping the assignement in a function 'setp':
function projects
{
reply=(*.mak) 2>/dev/null
reply=(${reply%.mak})
}
function setp
{
PROJECT=$1
}
compctl -K projects setp
Is there any way to avoid the wrapper function?
Regards,
Bernd
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-06-19 14:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-19 14:00 Completion for variable assigement Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
2000-06-18 20:33 Bernd Eggink
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).