Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion for variable assigement
- X-seq: zsh-users 3190
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Re: Completion for variable assigement
- Date: Mon, 19 Jun 2000 16:00:56 +0200 (MET DST)
- In-reply-to: Bernd Eggink's message of Sun, 18 Jun 2000 22:33:19 +0200
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author