Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with zsh-users/zsh-syntax-highlighting #46

Closed
zUnixorn opened this issue Feb 21, 2022 · 10 comments
Closed

does not work with zsh-users/zsh-syntax-highlighting #46

zUnixorn opened this issue Feb 21, 2022 · 10 comments

Comments

@zUnixorn
Copy link

zUnixorn commented Feb 21, 2022

when adding zpm load @github/zsh-users/zsh-syntax-highlighting,source:zsh-syntax-highlighting.zsh to the .zshrc I get this error:

(anon):43: no such file or directory: /home/jonas/.version
(anon):44: no such file or directory: /home/jonas/.revision-hash
zsh-syntax-highlighting: highlighters directory '/home/jonas/highlighters' not found.
zsh-syntax-highlighting: failed loading highlighters, exiting.

When I type zpm clean it works again, but when I start a new shell its throwing this error again. I tried adding path:/highlighters but that didn't change anything.

Do you know what i'd need to change to get it working with zpm?

plugin source: https://github.com/zsh-users/zsh-syntax-highlighting/

@grigorii-horos
Copy link
Member

Please, update zpm first

@zUnixorn
Copy link
Author

I just downloaded zpm when posting the issue, so it is up-to-date. And doing zpm upgrade also didn't help.

@grigorii-horos
Copy link
Member

Hm... Very strange. I just tested in clean env, and all works great.
image

@grigorii-horos
Copy link
Member

image

@zUnixorn
Copy link
Author

zUnixorn commented Feb 24, 2022

I tried it on three different distros (Void Linux, Arch Linux and Debian) and in every test I first ran exec zsh -d -f and then

if [[ ! -f ~/.local/share/zpm/zpm.zsh ]]; then
  git clone --recursive https://github.com/zpm-zsh/zpm ~/.local/share/zpm
fi
source ~/.local/share/zpm/zpm.zsh

zpm @github/zsh-users/zsh-syntax-highlighting,source:zsh-syntax-highlighting.zsh

and I got the same error on all three distros.

I am unsure what could be the cause of these different results, zsh -d -f should yield a clean enviornment so that shouldn't be the cause.

@zUnixorn
Copy link
Author

zUnixorn commented Feb 24, 2022

did you restart the shell and tried it again? Because when I stay in the same session everything works fine, like in your example. But when I close it I get that error, doing zpm clean and the zpm load fixes it for the current session, restarting it makes the error come up again...

@jqhr
Copy link

jqhr commented Mar 4, 2022

@grigorii-horos @zUnixorn
I also encountered this problem.That problem is due to /tmp/zsh-1000. The cache directory.
I add

[ -d /tmp/zsh-1000/ ] && rm -rf /tmp/zsh-1000/*

before source zpm/zpm.zsh.
And it works

@avently
Copy link

avently commented Mar 20, 2022

@grigorii-horos have the same problem with some plugins, Could you, please, take a look if you can fix the issues with them?

zpm load b4b4r07/enhancd
Result after opening a new shell:
__enhancd::init::init:5: no matches found: /tmp/zsh-1000/src/*.sh
zpm load zsh-users/zsh-history-substring-search
Result after opening a new shell:
(anon):source:3: No such file or directory: /home/user/zsh-history-substring-search.zsh

With other plugin managers they work fine.

@bw-matthew
Copy link

This error occurs with zsh-syntax-highlighting and zsh-autosuggestions. The underlying problem appears to be the resolution of the filename itself.

For zsh-syntax-highlighting the problem occurs here:
https://github.com/zsh-users/zsh-syntax-highlighting/blob/1386f1213eb0b0589d73cd3cf7c56e6a972a9bfd/zsh-syntax-highlighting.zsh#L38-L43

This is then the cause of the errors

(anon):43: no such file or directory: /home/jonas/.version
(anon):44: no such file or directory: /home/jonas/.revision-hash

Which is present in the original post (so they had that plugin too heh). The problem appears to be that the file that is loaded is within the /home/jonas folder (i.e. the folder containing the .zshrc file).

This is fundamentally due to the zpm-cache.zsh file that is produced. This is a combination of all of the commands required to load the plugins. This file sets $0 at the beginning of each function that is defined (the functions being a way to compartmentalize each installed plugin). This set is then overwritten by the original code in the plugin later on which breaks.

rickhallett pushed a commit to rickhallett/dotfiles that referenced this issue Nov 1, 2023
It cannot load from releases, it has a deep problem with the cache that
it generates:

    zpm-zsh/zpm#46
@grigorii-horos
Copy link
Member

Fixed in main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants