zsh-users
 help / color / mirror / code / Atom feed
From: lilydjwg <lilydjwg@gmail.com>
To: zsh-users@zsh.org
Subject: Re: Can't complete path with hidden .zfs?
Date: Thu, 25 May 2017 14:35:40 +0800	[thread overview]
Message-ID: <20170525063540.GA10491@lilyforest.localdomain> (raw)
In-Reply-To: <170524120340.ZM15282@torch.brasslantern.com>

On Wed, May 24, 2017 at 12:03:40PM -0700, Bart Schaefer wrote:
> On May 24,  6:41pm, lilydjwg wrote:
> }
> } It'll be great if I can use a custom function to decide what to add, so
> } I can add .zfs only when it actually exists.
> 
> There are two ways you can go here.
> 
> If the .zfs mappings don't change very often, you can test at the time
> your .zshrc etc. are read and assign to fake-files at that time.
> 
> On the other hand if either they change during your shell session or
> the check for them is very inexpensive, you can use "zstyle -e" to
> have a command executed every time the style is looked up.

Thanks you so much! I've got it to work perfectly now:

_get_zfs_fake_files () {
  reply=($(awk -vOFS=: -vORS=' ' '$9 == "zfs" { print $5, ".zfs" }' /proc/self/mountinfo))
}
zstyle -e ':completion:*' fake-files _get_zfs_fake_files

They do change often, because some of them are on one of my external
hard drivers.

-- 
Best regards,
lilydjwg


      reply	other threads:[~2017-05-25  6:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170518034638epcas3p184182faf0a2f6197f34386a052b7c856@epcas3p1.samsung.com>
2017-05-18  3:44 ` lilydjwg
2017-05-18  9:02   ` Peter Stephenson
2017-05-19  3:38     ` lilydjwg
2017-05-19  8:30       ` Peter Stephenson
2017-05-24 10:41         ` lilydjwg
2017-05-24 19:03           ` Bart Schaefer
2017-05-25  6:35             ` lilydjwg [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=20170525063540.GA10491@lilyforest.localdomain \
    --to=lilydjwg@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).