zsh-users / antigen

The plugin manager for zsh.
http://antigen.sharats.me
MIT License
8.01k stars 279 forks source link

"command not found" when loading Powerlevel10k via Antigen #699

Open DomParfitt opened 4 years ago

DomParfitt commented 4 years ago

Description

When I try to install the Powerlevel10k theme using Antigen I get the follow error on each key press:

(eval):2: command not found: -a
(eval):3: command not found: -i
(eval):4: command not found: MATCH

Steps to reproduce

Minimal steps to reproduce this behavior. Example:

1 - Open `zsh` terminal
2 - Type and run `antigen theme romkatv/powerlevel10k`
3 - The above error is display each time a key is pressed.

Expected behavior:

- The theme should be installed and the shell continues to function as normal.

Software version

Configuration

source "$HOME/antigen.zsh"
antigen use oh-my-zsh
antigen theme romkatv/powerlevel10k
antigen apply

More information

Discussion of the issue on the P10k repo can be found here.

romkatv commented 4 years ago

These reproduction steps no longer reproduce the issue as I've added a workaround in powerlevel10k.

The problem was caused by the code in Antigen that removes local from zsh files that it sources: https://github.com/zsh-users/antigen/blob/f5038faf456b412ef06cd17c6ae76404846d2c7e/src/lib/load.zsh#L84-L86

For example, suppose I define foo.zsh-theme with the following content:

local -i n=42

When foo.zsh-theme is loaded by Antigen, local is removed, which breaks code.