-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
bad pattern: funcs=(\n ~zsh-autocomplete/functions/.autocomplete.*~*.zwc(N-.:a)\n )
#335
Comments
Just tried with the Homebrew zsh Version "zsh 5.8 (arm-apple-darwin20.2.0)" same error. |
It's actually a bug in Zinit: https://github.com/zdharma/zinit/issues/366 I had a workaround for it, but it looks like it doesn't work anymore. I will add a new workaround. However, I do strongly recommend you switch to a plugin manager that doesn't do as much nonsense. |
I am open for suggestions. I only have fzf and two other zsh plugins I need. I would even add them in a fast way natively without a pm but I have no clue how to do that. I will take a closer look at that the next days, maybe I really dont need any. |
If you do want to use a plugin manager, I would naturally recommend Znap. 🙂 |
Okay wow you are amazing. Now I don't even see any blink or delay its just up in 0.1ms xD Combined it with Starship.rs and it's just the perfect fit for it. |
Great to hear! 😃 PS: If you enjoy using my software, please consider sponsoring me. |
This issue is still there, right? |
No, gone after updating, at least on my end. |
@weilbith Can you give me a reproducible test case? |
Hmm. I just created a new user. And then I do: $ zsh
% source /usr/share/zinit/zinit.zsh
% zinit lucid light-mode for marlonrichert/zsh-autocomplete
# installation output...
(anon):22: bad pattern: funcs=(\n ~zsh-autocomplete/functions/.autocomplete.*~*.zwc(N-.:a)\n )
% That appears on each new shell I open. Autocomplete doesn't work at all (god damn I love your plugin so much it is a nightmare without). And it is a little worse because Powerlevel10k instant prompt reports tons of output because something is logging before the first prompt. Very annoying atm. |
I'm seeing the same issue with zcomet:
Contents of
|
I didn’t realize it before, but this issue is a duplicate of #339. Also, 96fec14 doesn’t fix the problem you have; it’s a workaround for another Z Init problem. Apologies for the confusion. @weilbith It’s caused by a bug in Z Init: https://github.com/zdharma/zinit/issues/543. It’s not that hard to fix, though. See my comment there for an explanation. @jack1142 Looks like Z Comet has the same bug as Z Init. Again, see my comment on the Z Init issue for an explanation. When you open an issue on Z Comet’s repo, make sure you include a link to my comment. And in case you didn’t know it: I maintain a fast, lightweight & simple plugin manager called Znap, which naturally doesn’t suffer from the same problem. 😉 |
@muuvmuuv Because you are using Znap now, right? Because the problem still hasn’t been fixed in Z Init. 🙂 |
bad pattern: funcs=(\n ~zsh-autocomplete/functions/.autocomplete.*~*.zwc(N-.:a)\n )
I know. I'm thinking about alternatives. But Znap still has no lazy loading, correct? It also just costs time to switch. Atm a good question what would take more time. 😑
So I wen to
|
No, not correct. 🙂 Znap does have lazy loading:
For example, here's how to set up lazy loading for znap function _pyenv pyenv 'eval "$( pyenv init - --no-rehash )"'
compctl -K _pyenv pyenv
znap function _pip_completion pip 'eval "$( pip completion --zsh )"'
compctl -K _pip_completion pip
znap function _python_argcomplete pipx 'eval "$( register-python-argcomplete pipx )"'
complete -o nospace -o default -o bashdefault \
-F _python_argcomplete pipx
znap function _pipenv pipenv 'eval "$( pipenv --completion )"'
compdef _pipenv pipenv This way, initialization code for these commands won't run until you actually try to execute the command or try to invoke completion on it. 🙂 If you really want to go wild, you could even replace the |
I cannot reproduce that. Here's what I did: % cd $(mktemp -d)
git clone --depth 1 -- https://github.com/zdharma/zinit.git $PWD/.zinit/bin
> .zshrc <<EOF
PS1="%# " PS2=" " RPS2="< %^"; setopt transientrprompt
source $PWD/.zinit/bin/zinit.zsh
zinit load marlonrichert/zsh-autocomplete
EOF
env -i HOME=$PWD ZDOTDIR=$PWD FPATH=$FPATH TERM=$TERM zsh -d
/tmp/tmp.5y9lh2d3MO/
Cloning into '/tmp/tmp.5y9lh2d3MO/.zinit/bin'...
remote: Enumerating objects: 180, done.
remote: Counting objects: 100% (180/180), done.
remote: Compressing objects: 100% (163/163), done.
remote: Total 180 (delta 10), reused 120 (delta 8), pack-reused 0
Receiving objects: 100% (180/180), 1.04 MiB | 1.34 MiB/s, done.
Resolving deltas: 100% (10/10), done.
Downloading marlonrichert/zsh-autocomplete...
Cloning into '/tmp/tmp.5y9lh2d3MO/.zinit/plugins/marlonrichert---zsh-autocomplete'...
▗ █████████████████████████ OBJ: 100, PACK: 3247/3247, COMPR: 100%, REC: 100%, RES: 100%
Note: Compiling: zsh-autocomplete.plugin.zsh... OK.
Installed 10 completions. They are stored in $INSTALLED_COMPS array.
(anon):22: bad pattern: funcs=(\n ~zsh-autocomplete/functions/.autocomplete.*~*.zwc(N-.:a)\n )
% zcompile -R .zinit/plugins/marlonrichert---zsh-autocomplete/zsh-autocomplete.plugin.zsh
% exec zsh -d
% And now autocompletion works just fine. You have probably have some config that changes the way % emulate zsh -c 'zcompile -UzR .zinit/plugins/marlonrichert---zsh-autocomplete/zsh-autocomplete.plugin.zsh' This will invoke |
@marlonrichert Oh, I think you are right ^^ Did not think about that to be an issue with the pm rather than the plugin itself. |
Please disregard my comments so far as to what is the cause of the problem: On further investigation, it turns out that, actually, the only thing that fixes the problem, for both Z Init and Z Comet, is to |
At all here… Just use znap xD I really have less problems with it (thanks @marlonrichert). Can strongly recommend it! |
I see the same problem happening in Zim, which also automatically compiles such scripts. |
I can run this at the command line:
with the same results:
|
@agkozak Huh, indeed. I wonder why it's not a problem when Znap compiles things? |
I finally managed to figure it out: It's an unfortunate way in which compiled or autoloaded code in Zsh is not 100% equivalent to the original source code. But now that I now what causes it, I also know how to work around it. @agkozak Thanks for your help in tracking down the root cause of the problem! |
You're very welcome. I was just working on a similar patch, but I was not sure how many instances of |
I suspect the reason Znap didn't have a problem was because it already has |
Yes, that's exactly the reason I figured out, too. |
Thank you so much!! 🙏🏾 |
Not sure if that is related, but since the update I get very often these messages while completing (hitting
|
I already fixed that in 8877a3b. |
I can confirm that my |
Do |
Okay yes. But I first had to delete it. Dunno why. 🤷🏾 |
Delete what? |
For some reason I had to delete the local clone of the plugin my plugin manager did. In this exact example for my I had to delete |
@agkozak I noticed that Z Comet is actually not that different in syntax from Znap and that you even copied some features from me. Rather than compete with each other, would you be interested in joining forces and merge our plugin managers into one? |
I'm deeply honored that you'd ask, @marlonrichert! But I see us as doing two rather different things. I support Zsh as far back as 4.3.11, whereas you take advantage of the most cutting-edge features of the latest versions of the shell. It seems that we have different aims. I originally used a subset of Zinit's syntax, believe it or not! The whole point was to make my Zinit-based I do admire your project very much. I think the one element that I very consciously copied (as acknowledged in the code and the documentation) was your idea of using dynamic named directories for the Git repos. It is a very elegant feature. |
zsh-autocomplete
version: latest I assumeI was not able to reproduce it with the template you provided because I only get this error on loading the shell:
My zshrc:
My zsh_history looks like this:
The text was updated successfully, but these errors were encountered: