zsh-users
 help / color / mirror / code / Atom feed
* completing .directories without . and ..
@ 2023-02-21 16:38 Thomas Lauer
  2023-02-21 16:48 ` Roman Perepelitsa
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Lauer @ 2023-02-21 16:38 UTC (permalink / raw)
  To: zsh-users

Subj says it all... in some directories I have many .subdirs and when I
complete them (ie start completion with .<TAB>) I get all the .subdirs
but also . and .. which in 99.99987% of cases I don't need and don't
want.

There's probably a zstyle that'll do that but I am not able to find it
despite looking through the relevant docs. So I am looking to the
resident wi(zsh)ards for an idea...

Thanks

T


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-21 16:38 completing .directories without . and Thomas Lauer
@ 2023-02-21 16:48 ` Roman Perepelitsa
  2023-02-21 16:59   ` Thomas Lauer
  0 siblings, 1 reply; 10+ messages in thread
From: Roman Perepelitsa @ 2023-02-21 16:48 UTC (permalink / raw)
  To: Thomas Lauer; +Cc: zsh-users

On Tue, Feb 21, 2023 at 5:39 PM Thomas Lauer <thomas.lauer@virgin.net> wrote:
>
> Subj says it all... in some directories I have many .subdirs and when I
> complete them (ie start completion with .<TAB>) I get all the .subdirs
> but also . and .. which in 99.99987% of cases I don't need and don't
> want.

This isn't the default. You must have explicitly set special-dirs to
true. See "special-dirs" in `man zshcompsys` for documentation.

Roman.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-21 16:48 ` Roman Perepelitsa
@ 2023-02-21 16:59   ` Thomas Lauer
  2023-02-21 17:14     ` Ray Andrews
  2023-02-21 19:14     ` Roman Perepelitsa
  0 siblings, 2 replies; 10+ messages in thread
From: Thomas Lauer @ 2023-02-21 16:59 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: zsh-users

From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Date: Tue, 21 Feb 2023 17:48:44 +0100
> See "special-dirs" in `man zshcompsys` for documentation.

Right. I knew it was something simple but all my attempts to find that
simple thing were getting nowhere. And googling with such terms as . or
.. is an exercise in futility (not to talk about stuff like -option or
--option).

Problem solved. Many thanks!

T


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-21 16:59   ` Thomas Lauer
@ 2023-02-21 17:14     ` Ray Andrews
  2023-02-21 18:09       ` Thomas Lauer
  2023-02-21 19:14     ` Roman Perepelitsa
  1 sibling, 1 reply; 10+ messages in thread
From: Ray Andrews @ 2023-02-21 17:14 UTC (permalink / raw)
  To: zsh-users


On 2023-02-21 08:59, Thomas Lauer wrote:
> And googling with such terms as . or
> .. is an exercise in futility (not to talk about stuff like -option or
> --option).
I whine about things like that often.  The terseness of zsh syntax makes 
google searches for actual syntax often absurd.    But apart from 
inside-out learning, is a solution even possible?  Maybe. Meanwhile, 
thank God for this list, where you can just doff your cap and ask the 
people who know.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-21 17:14     ` Ray Andrews
@ 2023-02-21 18:09       ` Thomas Lauer
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Lauer @ 2023-02-21 18:09 UTC (permalink / raw)
  To: Ray Andrews; +Cc: zsh-users

From: Ray Andrews <rayandrews@eastlink.ca>
Date: Tue, 21 Feb 2023 09:14:29 -0800
> 
> On 2023-02-21 08:59, Thomas Lauer wrote:
> > And googling with such terms as . or
> > .. is an exercise in futility (not to talk about stuff like -option or
> > --option).
> I whine about things like that often.  The terseness of zsh syntax makes 
> google searches for actual syntax often absurd.    But apart from 
> inside-out learning, is a solution even possible?  Maybe. Meanwhile, 
> thank God for this list, where you can just doff your cap and ask the 
> people who know.

(Possibly future) versions of something like ChatGPT et al could well
present a solution for these things. They'd be able to discern and
understand (within certain limits) the actual semantics of what is being
asked and should, after (perhaps extensive) training, be able to deliver
relevant answers or at the very least pointers to answers.

T


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-21 16:59   ` Thomas Lauer
  2023-02-21 17:14     ` Ray Andrews
@ 2023-02-21 19:14     ` Roman Perepelitsa
  2023-02-21 21:25       ` Ray Andrews
                         ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Roman Perepelitsa @ 2023-02-21 19:14 UTC (permalink / raw)
  To: Thomas Lauer; +Cc: zsh-users

On Tue, Feb 21, 2023 at 5:59 PM Thomas Lauer <thomas.lauer@virgin.net> wrote:
>
> From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
> Date: Tue, 21 Feb 2023 17:48:44 +0100
> > See "special-dirs" in `man zshcompsys` for documentation.
>
> Right. I knew it was something simple but all my attempts to find that
> simple thing were getting nowhere.

Here's a hypothetical yet plausible way how you could've found it.

First, look at `man zsh`. At the very top it has an index. Given that
you are trying to customize completions, there are 3 candidates that
mention completions:

    zshcompwid   Zsh completion widgets
    zshcompsys   Zsh completion system
    zshcompctl   Zsh completion control

zshcompctl is a trap. Hopefully you wouldn't fall for it given this
sentence at the top of it:

    New users of the shell may prefer to use the newer and more
    powerful system based on shell functions; this is described in
    zshcompsys(1), and the basic shell mechanisms which
    support it are described in zshcompwid(1).

This hints that zshcompwid isn't what you want either. Let's check it anyway:

    A  complete set of shell functions based on these features is
    described in zshcompsys(1), and users with no interest in
    adding to that system (or, potentially, writing their own -- see
    dictionary entry for `hubris') should skip the current section.
    The older system based on the compctl builtin command is
    described in zshcompctl(1).

This confirms that zshcompctl is a trap that you should avoid, and
that zshcompwid describes the low level API on top of which the
user-facing zshcompsys is built.

Hopefully, eventually you would've looked at zshcompcsys. Searching
".." would then land you on special-dirs fairly quickly.

Note that if you already knew that the user-facing docs for
completions are in zshcompsys, the search would be fairly
straightforward.

There are only 9 zsh man pages that I ever look at (plus zshall if I'm
unsure which one I need), and I remember their names by now. Before I
learned them, I often opened `man zsh` to see the list of section
names with short descriptions.


Roman.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-21 19:14     ` Roman Perepelitsa
@ 2023-02-21 21:25       ` Ray Andrews
  2023-02-21 22:11       ` Bart Schaefer
  2023-02-22 13:16       ` Thomas Lauer
  2 siblings, 0 replies; 10+ messages in thread
From: Ray Andrews @ 2023-02-21 21:25 UTC (permalink / raw)
  To: zsh-users


On 2023-02-21 11:14, Roman Perepelitsa wrote:
>
> This confirms that zshcompctl is a trap that you should avoid,
Which begs the question why it's still there.  IMHO the agenda for zsh 
6.0 would be simply to purge everything obsolete, especially things 
characterized as traps.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-21 19:14     ` Roman Perepelitsa
  2023-02-21 21:25       ` Ray Andrews
@ 2023-02-21 22:11       ` Bart Schaefer
  2023-02-22 13:16       ` Thomas Lauer
  2 siblings, 0 replies; 10+ messages in thread
From: Bart Schaefer @ 2023-02-21 22:11 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: Thomas Lauer, zsh-users

On Tue, Feb 21, 2023 at 11:14 AM Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> zshcompctl is a trap.

That's characterizing it a bit harshly.  zshcompctl is the user API to
the fallback completion mechanism that's present when the full
function suite is not available.  If a minimal, static-linked shell is
compiled for an embedded application or the like, compctl is what
you'd have (or nothing, if the constraints are really tight).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-21 19:14     ` Roman Perepelitsa
  2023-02-21 21:25       ` Ray Andrews
  2023-02-21 22:11       ` Bart Schaefer
@ 2023-02-22 13:16       ` Thomas Lauer
  2023-02-22 13:31         ` Thomas Lauer
  2 siblings, 1 reply; 10+ messages in thread
From: Thomas Lauer @ 2023-02-22 13:16 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: zsh-users

From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Date: Tue, 21 Feb 2023 20:14:22 +0100
Subj: Re: completing .directories without . and ..
> On Tue, Feb 21, 2023 at 5:59 PM Thomas Lauer <thomas.lauer@virgin.net> wrote:
> >
> > From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
> > Date: Tue, 21 Feb 2023 17:48:44 +0100
> > > See "special-dirs" in `man zshcompsys` for documentation.
> >
> > Right. I knew it was something simple but all my attempts to find that
> > simple thing were getting nowhere.
> 
> Here's a hypothetical yet plausible way how you could've found it.
<rest snipped>

Yeah, I normally follow a similar path (at least when I've got an idea
where to look... zsh being zsh means that this is not always obvious to
a "casual" user). In this case I knew it had to be a zstyle thing but I
somehow got fixated on the search term dotdir or dot-dir (or
variations)... that probably had to do with the fruitless Google
searches I'd done before.

Anyway, I'll try harder to broaden my knowledge of how to find
zshtuff:-)

T


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: completing .directories without . and ..
  2023-02-22 13:16       ` Thomas Lauer
@ 2023-02-22 13:31         ` Thomas Lauer
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Lauer @ 2023-02-22 13:31 UTC (permalink / raw)
  To: Thomas Lauer; +Cc: Roman Perepelitsa, zsh-users

From: Thomas Lauer <thomas.lauer@virgin.net>
Date: Wed, 22 Feb 2023 13:16:58 +0000
> In this case I knew it had to be a zstyle thing

Let me add another observation. There are areas within zsh and the docs
where I (perhaps falsely) believe I have a good idea how things work or
hang together. And then there are a couple other bits which to my mind
are almost beyond comprehension and which I approach with, shall we say,
some apprehension. The completion system is one of those and I readily
admit that I could and should invest a good chunk of time to try to get
a handle on that.

Many decades ago, I bought a 6502 microcomputer and big blue book about
6502 assembly language. I knew nothing about computers, let alone
machine language, and I read that book perhaps five times until I began
to get a glimmer of an idea what this stuff was all about. I was on a
long and boring holiday then, so time was no problem:-) and so I read it
again and still again until it started to make sense.

T


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-02-22 13:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21 16:38 completing .directories without . and Thomas Lauer
2023-02-21 16:48 ` Roman Perepelitsa
2023-02-21 16:59   ` Thomas Lauer
2023-02-21 17:14     ` Ray Andrews
2023-02-21 18:09       ` Thomas Lauer
2023-02-21 19:14     ` Roman Perepelitsa
2023-02-21 21:25       ` Ray Andrews
2023-02-21 22:11       ` Bart Schaefer
2023-02-22 13:16       ` Thomas Lauer
2023-02-22 13:31         ` Thomas Lauer

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).