babarot/enhancd

enhancd is not working in zinit with msys2

SavageChieftain opened this issue · 5 comments

What did you expect to happen?

b4b4r07/enhanced installs successfully with zinit & Zsh & MSYS2.
And, My comfortable CLI life starts!

What actually happened?

But it didn't...
Installation was successful but not working.

Output

  • console output
/home/{username}/.zinit/plugins/b4b4r07---enhancd/enhancd.plugin.zsh:1: command not found: init.sh
  • my .zshrc ※I only list relevant parts
zinit ice wait'!0'
zinit light "b4b4r07/enhancd"

Additional context

i think this is due to msys2's handling of symbolic links.
zinit autoloads enhancd.plugin.zsh (like antigen),
But zinit doesn't seem to find init.sh.
I think, msys2 is a somewhat major environment in Windows.
Please stop using enhancd.plugin.zsh as symbolic links.

Detour)msys2 + zsh + zinit + enhancd

zinit ice proto'git' pick'init.sh'
zinit light b4b4r07/enhancd

work it. But, unnecessary (may be), _enhancd_xxxxx.fish files are added to zinit completion.
if these files not exists, compinit output errors in console.
※This is not the subject, as it may be due to zinit.

I’m not using zinit and not familiar with it. So, I cannot answer it correctly. However, what you say as the workaround looks not a workaround for me. I think it seems correct way.

zinit ice proto'git' pick'init.sh'
zinit light b4b4r07/enhancd

If you change your original settings to above one, do you have any troubles?

Well, it's more of an MSYS2 environment-dependent issue.
Now version MSYS2 dont understand relative paths of Symblic link.
So, enhancd.plugin.zsh is interpreted as a link file to a file that does not exist and an error has occurred...

Here's what I mean: Do not use enhancd.plugin.zsh as a symbolic link. This does not work well under Windows env. (If enhancd support antigen continue

The following are likely to be unrelated to this repository


In tag v2.2.4, These setting is works fine.

zinit ice wait'!0'
zinit light "b4b4r07/enhancd"

No files for fish shell were added to zsh completion, nor did compinit give an error.

If you change your original settings to above one, do you have any troubles?

No, it works fine for now for now.
However, this setting adds the functions for the fish shell to zsh completion.
I don't think it's a good condition to have extraneous things for zsh.
(But don't think this is enhancd's issues.

zinit ice proto'git' pick'init.sh'
zinit light b4b4r07/enhancd

Folder structure after installation with this setting

~/
┗.zinit/
  ┗completions/
        ┣_enhancd_cd_after.fish
         ~~~~~~~~~
    Omitted
         ~~~~~~~~~
        ┗_enhancd_source_mru.fish

Originaly... I should write lazy loading settings(zinit ice wait'time or after function etc...').
※Like write zplug zplug "b4b4r07/enhancd", use:"init.sh", lazy:true
If i do these, fish shell's functions will not be added to zsh completion. I did it!

But, Lazy Load setting cause compinit error output.
(Also, I don't think this is an enhancd's issue.

sample)

compinit:503: no such file or directory: /home/{username}/.zinit/completions/_enhancd_cd_after.fish
compinit:503: no such file or directory: /home/{username}/.zinit/completions/_enhancd_cd_before.fish
compinit:shift:505: shift count must be <= $#

Was self resolved.
So, i close this issue

zinit is compiled before init.sh is executed.
As a result, fish shell files were autoloaded in zsh.

There is a way to delay compilation, so I will share it.

# Easy Way ※If you don't mind light errors during installation in completion.zsh
zinit ice atclone'./init.sh' nocompile'!' wait'!0' 

# Environment where symbolic links cannot be used (msys2)
zinit ice \
  atclone'rm -rf conf.d; rm -rf functions; rm -f *.fish;' \
  pick'init.sh' \
  nocompile'!' \
  wait'!0' 
zinit light b4b4r07/enhancd 

p.s. But after all, I don't want the starting file of the plugin to be a symbolic link.

zinit wait"1" lucid light-mode for 
    \b4b4r07/enhancd

zinit wait lucid atload"zicompinit; zicdreplay" blockf for \
    zsh-users/zsh-completions

the terminal show:
compinit:503: no such file or directory: ~/.zinit/completions/_enhancd_XXX.fish
I checked it:

  1. The symbol links broken.
  2. The real resources b4b4r07---enhancd/functions is not downloaded.

How can I fix it, please?

There is a temporary workaround:
#117 (comment)

in enhancd/init.sh:

 # Remove fish sources
    if [[ -d "$ENHANCD_ROOT"/functions ]]; then
        rm -rfd "$ENHANCD_ROOT"/functions
    fi

However, the *.fish is useless for zsh.
So The question is should not link b4b4r07---enhancd/functions to ~/.zinit/completions/.

Run zinit cclear.