Skip to content

The mangled suffix breaks usage with antigen and zgen #168

Closed
zsh-users/antigen
#713
@belak

Description

@belak

This was caused by dbeb163

Because of how antigen works, when it loads from the cache, at the point where it sources the plugin file, $1 is unfortunately set to apply, so all the gitstatus functions are loaded with the apply suffix with breaks quite a few things.

Additionally, on initial load with zgen, the following error pops up:

/Users/belak/.zgen/romkatv/gitstatus-master/gitstatus.plugin.zsh:typeset:58: not valid in this context: _gitstatus_plugin_dir/Users/belak/.zgen/romkatv/gitstatus-master/gitstatus.plugin.zsh

It seems like at that point, $1 is /Users/belak/.zgen/romkatv/gitstatus-master/gitstatus.plugin.zsh.

zplug works, but this is only because it uses shift so by the time the file is sourced, $1 is no longer set: https://github.com/zplug/zplug/blob/master/base/core/load.zsh#L62-L81

Sample usage with antigen:

[[ ! -d "$HOME/.antigen" ]] && git clone https://github.com/zsh-users/antigen.git "$HOME/.antigen"
source "$HOME/.antigen/antigen.zsh"
antigen bundle romkatv/gitstatus
antigen apply

Sample usage with zgen:

[[ ! -d "$HOME/.zgen" ]] && git clone https://github.com/tarjoilija/zgen.git "$HOME/.zgen"
source "${HOME}/.zgen/zgen.zsh"
if ! zgen saved; then
  zgen load romkatv/gitstatus
  zgen save
fi

Is there a different variable that could be used other than $1? It seems like the current setting is an easy way to silently break things in unexpected ways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions