I accidentally hit "d<tab>" and a list of things got displayed (menu completion), including dis_aliases dis_builtins dis_functions dis_functions_source dis_galiases dis_patchars "which" doesn't know where these come from; no functions, aliases or executables. Questions: * Why are these things completed (by expand-or-complete)? * How can non-executable strings be excluded from expansion. * Where does this stuff come from? (Only of minor interest) (zsh-5.7.1). Ciao Dominik ^_^ ^_^ -- Dominik Vogt
On Fri, Oct 15, 2021 at 8:43 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> I accidentally hit "d<tab>" and a list of things got displayed
> (menu completion), including
>
> dis_aliases
> dis_builtins
> dis_functions
> dis_functions_source
> dis_galiases
> dis_patchars
These are parameters. They come from the zsh/parameter module. See
`man zshmodules`.
Roman.
On Fri, Oct 15, 2021 at 08:46:27PM +0200, Roman Perepelitsa wrote:
> On Fri, Oct 15, 2021 at 8:43 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
> >
> > I accidentally hit "d<tab>" and a list of things got displayed
> > (menu completion), including
> >
> > dis_aliases
> > dis_builtins
> > dis_functions
> > dis_functions_source
> > dis_galiases
> > dis_patchars
>
> These are parameters. They come from the zsh/parameter module. See
> `man zshmodules`.
Okay, understood. But why is it useful to expand hashtable names
in command position?
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
On Fri, Oct 15, 2021 at 8:59 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> On Fri, Oct 15, 2021 at 08:46:27PM +0200, Roman Perepelitsa wrote:
> > On Fri, Oct 15, 2021 at 8:43 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
> > >
> > > I accidentally hit "d<tab>" and a list of things got displayed
> > > (menu completion), including
> > >
> > > dis_aliases
> > > dis_builtins
> > > dis_functions
> > > dis_functions_source
> > > dis_galiases
> > > dis_patchars
> >
> > These are parameters. They come from the zsh/parameter module. See
> > `man zshmodules`.
>
> Okay, understood. But why is it useful to expand hashtable names
> in command position?
I don't think it's useful. You can disable it:
zstyle ':completion:*:complete:-command-:*:*' tag-order \
'commands functions' -
I don't know why the default is what it is. I don't expect zsh
defaults to make sense. Why is interactive_comments disabled in
interactive shells? Why does prompt show hostname but not the current
directory? It's all for historical reasons, I guess. I do appreciate
that my shell doesn't break when I upgrade to a newer version of zsh,
so backward compatibility is a valid justification for all this.
Roman.
On Fri, Oct 15, 2021 at 12:13 PM Roman Perepelitsa <roman.perepelitsa@gmail.com> wrote: > > > Okay, understood. But why is it useful to expand hashtable names > > in command position? > > I don't think it's useful. It's not "expanding" hashtable names, it's completing parameter names because you might want to assign to them. Having % PA<tab> % PATH= would be a better example. You don't get the "=" when there are multiple possibilities. > I don't know why the default is what it is. I don't expect zsh > defaults to make sense. Why is interactive_comments disabled in > interactive shells? Because csh didn't have interactive comments, and zsh was designed to help college students using BSD unixen migrate from default csh to a bourne-like shell. > Why does prompt show hostname but not the current > directory? There originally wasn't a prompt escape for directory, IIRC ... and we're back to historical usage where users were on time-shared machinery and might need to know. > It's all for historical reasons, I guess. Yep, in a lot of cases dating back to how universities in the USA in the 1990s tended to configure their servers/users.
On Fri, Oct 15, 2021 at 01:10:27PM -0700, Bart Schaefer wrote:
> On Fri, Oct 15, 2021 at 12:13 PM Roman Perepelitsa
> <roman.perepelitsa@gmail.com> wrote:
> >
> > > Okay, understood. But why is it useful to expand hashtable names
> > > in command position?
> >
> > I don't think it's useful.
>
> It's not "expanding" hashtable names, it's completing parameter names
> because you might want to assign to them. Having
>
> % PA<tab>
> % PATH=
>
> would be a better example. You don't get the "=" when there are
> multiple possibilities.
Hm, it *is* somewhat confusing to be offered zsh internal
parameter names that come from a module that was loaded as a
dependency of zsh/complist (which is the olny module I use).
Is there a way to tell zsh only to complete parameter names that
are actually in the environment and not zsh internal ones?
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
On Fri, Oct 15, 2021 at 1:29 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> Is there a way to tell zsh only to complete parameter names that
> are actually in the environment and not zsh internal ones?
It ought to be possible with the tag-order style and examination of
the keys/values in the $parameters special hash, but I don't have time
to work out the details just now.
On Sat, Oct 16, 2021 at 11:59:34AM -0700, Bart Schaefer wrote:
> On Fri, Oct 15, 2021 at 1:29 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
> >
> > Is there a way to tell zsh only to complete parameter names that
> > are actually in the environment and not zsh internal ones?
>
> It ought to be possible with the tag-order style and examination of
> the keys/values in the $parameters special hash, but I don't have time
> to work out the details just now.
'k. Please don't waste time on this, it's not important.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
On Sat, Oct 16, 2021 at 2:33 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> On Sat, Oct 16, 2021 at 11:59:34AM -0700, Bart Schaefer wrote:
> > On Fri, Oct 15, 2021 at 1:29 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
> > >
> > > Is there a way to tell zsh only to complete parameter names that
> > > are actually in the environment and not zsh internal ones?
> >
> > It ought to be possible with the tag-order style and examination of
> > the keys/values in the $parameters special hash
>
> 'k. Please don't waste time on this, it's not important.
Actually the tag-order part is the hard bit and probably overkill
anyway. This should be enough:
zstyle -e :completion::complete:-command-::parameters \
ignored-patterns 'reply=(${(k)parameters[(R)*(hidden|undefined)*])'