* default completion function
@ 2018-03-07 12:28 ` Pier Paolo Grassi
2018-03-07 13:52 ` Peter Stephenson
0 siblings, 1 reply; 4+ messages in thread
From: Pier Paolo Grassi @ 2018-03-07 12:28 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]
Hello everybody, I would like to make the completion function _gnu_generic
the default completion for those functions that don't have something more
specific attached to them.
If I use:
zstyle ':completion:*' completer _gnu_generic
a command like docker that has his own completion loses it and gets
completed with _gnu_generic.
How can I set a default like that without overwriting existing more
specific completion?
thanks
--
Pier Paolo Grassi
email: pierpaolog@gmail.com
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
fondatore: https://www.meetup.com/it-IT/Machine-Learning-TO
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: default completion function
2018-03-07 12:28 ` default completion function Pier Paolo Grassi
@ 2018-03-07 13:52 ` Peter Stephenson
2018-03-11 18:20 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2018-03-07 13:52 UTC (permalink / raw)
To: Pier Paolo Grassi, zsh-users
On Wed, 7 Mar 2018 13:28:38 +0100
Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> Hello everybody, I would like to make the completion function
> _gnu_generic the default completion for those functions that don't
> have something more specific attached to them.
> If I use:
>
> zstyle ':completion:*' completer _gnu_generic
>
> a command like docker that has his own completion loses it and gets
> completed with _gnu_generic.
> How can I set a default like that without overwriting existing more
> specific completion?
The obvious way (so probably this is too simple) is to override the
function _default, the normal version of which you'll find in your
$fpath. As long as your function starts with "#compdef -default-" and
is earlier in your $fpath it should be used in preference.
pws
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: default completion function
2018-03-07 13:52 ` Peter Stephenson
@ 2018-03-11 18:20 ` Bart Schaefer
2018-03-11 23:19 ` Pier Paolo Grassi
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2018-03-11 18:20 UTC (permalink / raw)
To: Pier Paolo Grassi, zsh-users
On Mar 7, 1:52pm, Peter Stephenson wrote:
} Subject: Re: default completion function
}
} On Wed, 7 Mar 2018 13:28:38 +0100
} Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
} > How can I set a default like that without overwriting existing more
} > specific completion?
}
} The obvious way (so probably this is too simple) is to override the
} function _default, the normal version of which you'll find in your
} $fpath. As long as your function starts with "#compdef -default-" and
} is earlier in your $fpath it should be used in preference.
I wouldn't recommend that. The _gnu_generic function falls back on
_default so this potentially creates infinite recursion.
Much better: compdef _gnu_generic -default-
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: default completion function
2018-03-11 18:20 ` Bart Schaefer
@ 2018-03-11 23:19 ` Pier Paolo Grassi
0 siblings, 0 replies; 4+ messages in thread
From: Pier Paolo Grassi @ 2018-03-11 23:19 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-users
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
that worked very nice, thank you!
2018-03-11 19:20 GMT+01:00 Bart Schaefer <schaefer@brasslantern.com>:
> On Mar 7, 1:52pm, Peter Stephenson wrote:
> } Subject: Re: default completion function
> }
> } On Wed, 7 Mar 2018 13:28:38 +0100
> } Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> } > How can I set a default like that without overwriting existing more
> } > specific completion?
> }
> } The obvious way (so probably this is too simple) is to override the
> } function _default, the normal version of which you'll find in your
> } $fpath. As long as your function starts with "#compdef -default-" and
> } is earlier in your $fpath it should be used in preference.
>
> I wouldn't recommend that. The _gnu_generic function falls back on
> _default so this potentially creates infinite recursion.
>
> Much better: compdef _gnu_generic -default-
>
--
Pier Paolo Grassi
email: pierpaolog@gmail.com
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
fondatore: https://www.meetup.com/it-IT/Machine-Learning-TO
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-11 23:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20180307123046epcas2p3556030f6d223cd5943cc628df87eea6e@epcas2p3.samsung.com>
2018-03-07 12:28 ` default completion function Pier Paolo Grassi
2018-03-07 13:52 ` Peter Stephenson
2018-03-11 18:20 ` Bart Schaefer
2018-03-11 23:19 ` Pier Paolo Grassi
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).