Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can't complete path with hidden .zfs?



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



Messages sorted by: Reverse Date, Date, Thread, Author