zsh-users
 help / color / mirror / code / Atom feed
From: "François RONVAUX" <francois.ronvaux@gmail.com>
To: zsh-users@zsh.org
Subject: Re: Completion does not work with hidden files/directories
Date: Mon, 31 May 2021 09:16:00 +0200	[thread overview]
Message-ID: <CAMbPAZ5R8PTPdoqoqNyYj59NQ29jVsW9UzKv=6paZT3W12Am5g@mail.gmail.com> (raw)
In-Reply-To: <86341-1622379181.040384@EIIb.SjlL.3aYW>

[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]

Oliver,

Thank you for your reply.

Le dim. 30 mai 2021 à 14:53, Oliver Kiddle <opk@zsh.org> a écrit :

> Fran?ois RONVAUX wrote:
> > In my home directory, there are currently only hidden files/directories
> and the
> > completion mechanism does not see them :-(
>
> The main way to control which files are included in file completion is
> via the file-patterns style. So if you always want to see hidden files,
> it would be something like:
>
>   zstyle ':completion:*' file-patterns '%p(D):globbed-files
> *(D-/):directories' '*(D):all-files'
>
> (D) is a glob qualifier that includes hidden files and you might use it
> from the command-line as, e.g. *.png(D)
>
> I was going to suggest something like the following which adds the (D)
> to the all-files fallback:
>
>   zstyle ':completion:*' file-patterns '%p:globbed-files
> *(-/):directories' '*(D):all-files'
>
> Unfortunately, _files has some sort of shortcut where it does:
>
>   [[ "$pat" = '*' ]] && return ret
>
> So it never tried all-files if globbed-files was using * as a glob. This
> should perhaps be looked into and discussed on -workers.
>
> What you can do, however is add a second run of the _complete completer
> with the separate file-patterns style:
>
>   zstyle ':completion:*::::' completer _complete _complete:-hidden
>   zstyle ':completion:*:complete-hidden:*' file-patterns
> '%p(D):globbed-files' '*(D):all-files'
>
> Note, however that you likely already have a completer style with other
> functions like _expand listed and you should only add _complete:-hidden
> to the list somewhere after _complete.
>
> > Same issue when I want to change of directory :
>
> cd doesn't use files so file-patterns may not help there.
>
> > zstyle ':completion:*' cache-path ${ZDOTDIR}/zsh_cache
> > zstyle ':completion:*' use-cache true #on
>
> > Second issue (less important) : the section "Create a cache" in the
> above file
> > does not work.
>
> Only some completion functions need to create a cache. Note that those
> lines do not create a cache, they only tell completion where to put cache
> files. Is ${ZDOTDIR} definitely set to something. If not, it could be
> trying /zsh_cache. The directory you specify should already exist and
> should be a writable directory.
>
> Oliver
>

[-- Attachment #2: Type: text/html, Size: 2876 bytes --]

      reply	other threads:[~2021-05-31  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30 10:39 François RONVAUX
2021-05-30 12:53 ` Oliver Kiddle
2021-05-31  7:16   ` François RONVAUX [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMbPAZ5R8PTPdoqoqNyYj59NQ29jVsW9UzKv=6paZT3W12Am5g@mail.gmail.com' \
    --to=francois.ronvaux@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).