zsh-autocomplete: `bad pattern: funcs=(\n ~zsh-autocomplete/functions/.autocomplete.*~*.zwc(N-.:a)\n )`

  • zsh-autocomplete version: latest I assume
  • Zsh version: zsh 5.8 (x86_64-apple-darwin20.0)
  • Framework: Starship
  • Plugin manager: zinit
  • Operating system: macOS ARM latest release

I was not able to reproduce it with the template you provided because I only get this error on loading the shell:

~/Development
;
(anon):22: bad pattern: funcs=(\n      ~zsh-autocomplete/functions/.autocomplete.*~*.zwc(N-.:a)\n  )

My zshrc:

eval "$(starship init zsh)"

export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"

alias vim="nvim"
alias dir="ls -lah"
alias zshrc="code ~/.zshrc"

# Globbing

setopt NO_CASE_GLOB
setopt EXTENDED_GLOB

# History

HISTORY_IGNORE="(ls|dir|cd|pwd|exit|cd ..|..|*venv*)"

setopt EXTENDED_HISTORY
setopt INC_APPEND_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_IGNORE_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS

# Misc

setopt AUTO_CD
setopt MENU_COMPLETE
setopt NO_LIST_AMBIGUOUS

# Settings

zstyle ':autocomplete:*' min-input 2
zstyle ':autocomplete:tab:*' fzf-completion yes

# Plugins

source "$HOME/.zinit/bin/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit

zinit wait lucid light-mode for \
  marlonrichert/zsh-autocomplete \
  atinit"zicompinit; zicdreplay" \
      zdharma/fast-syntax-highlighting \
  blockf atpull'zinit creinstall -q .' \
      zsh-users/zsh-completions

zinit ice from"gh-r" as"program" bpick"*arm*"
zinit light junegunn/fzf

My zsh_history looks like this:

: 1631085612:0;cd app

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 36 (16 by maintainers)

Most upvoted comments

But Znap still has no lazy loading, correct?

No, not correct. 🙂 Znap does have lazy loading:

% znap help function
Usage: znap function <func name> ... <init code>
Create a set of lazy-loading functions.

For example, here’s how to set up lazy loading for pyenv, pip, pipx and pipenv and their respective completion functions:

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 eval "$( <command> )" statements in there with znap eval "<command>", but in my experience, that’s not really necessary.

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.

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.

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 .zshrc work when I was using Zsh < 5.0.8. But when I decided to stop using Zinit and do my own thing, it seemed preferable to opt for a simpler, more Antigen-like syntax.

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.

@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?

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 $XDG_CACHE_HOME/zinit/plugins/marlonrichert---zsh-autocomplete. It then reinstalled it and then it was fine. The HEAD of the commit before I deleted the directory and afterwards was the same. Dunno what was the difference here. Maybe some “compile” hook or so? 🤷🏾

Okay yes. But I first had to delete it. Dunno why. 🤷🏾 Thank you!

Thank you so much!! 🙏🏾 So nice to have my old full functional shell back. 😆

You’re very welcome. I was just working on a similar patch, but I was not sure how many instances of private needed to be changed. It looks as if you’ve done a very thorough job.

@marlonrichert Oh, I think you are right ^^ Did not think about that to be an issue with the pm rather than the plugin itself.

I didn’t realize it before, but this issue is a duplicate of #339.

Also, 96fec14c2963d06412af82c9873c5ff64336a1a3 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. 😉

No, gone after updating, at least on my end.

Great to hear! 😃


PS: If you enjoy using my software, please consider sponsoring me.

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.