zsh-users / antigen

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

source ~/.zshrc Permanently Messed Up Antigen #675

Open mssngr opened 6 years ago

mssngr commented 6 years ago

Description

I was following a tutorial for installing awscli and ran source ~/.zshrc. Ever since, even after resetting my laptop, my terminal now spits out:

expr: syntax error
expr: syntax error
/Users/gbriel/.antigen/bundles/unixorn/autoupdate-antigen.zshplugin/autoupdate-antigen.zsh:[:49: unknown condition: -gt
/Users/gbriel/.antigen/bundles/unixorn/autoupdate-antigen.zshplugin/autoupdate-antigen.zsh:[:58: unknown condition: -gt

every time I boot it up.

Not sure what's going on, at all. Don't know why sourcing the zshrc would do this.

Steps to reproduce:

  1. Open terminal with zsh/antigen
  2. source ~/.zshrc
  3. Restart the terminal

Expected behavior:

Software version

Configuration

I have no .antigenrc

.zshrc

source ~/antigen.zsh

# Load the oh-my-zsh's library.
antigen use oh-my-zsh

antigen bundles <<EOBUNDLES

# Bundles from the default repo (robbyrussell's oh-my-zsh).
    # Suggests package name with relevant command.
    command-not-found

    # Adds colors to manpages.
    colored-man-pages

    # Redis autocompletion.
    redis-cli

    # MacOS completions and iTunes & Spotify control.
    osx

# Bundles from zsh-users.
    # Fish-like autosuggestions for zsh.
    zsh-users/zsh-autosuggestions

    # Additional completion definitions for Zsh.
    zsh-users/zsh-completions

    # ZSH port of the FISH shell's history search 🐠.
    zsh-users/zsh-history-substring-search

    # # Fish shell like syntax highlighting for Zsh.
    # zsh-users/zsh-syntax-highlighting

# Other Bundles.
    # zsh theme for Hyper.
    tylerreckart/hyperzsh

    # Automatically ls and git-status when cding to a new directory.
    desyncr/auto-ls

    # Quickly go back to a specific parent directory.
    Tarrasch/zsh-bd

    # Auto updating, both of antigen and the bundles loaded in your config.
    unixorn/autoupdate-antigen.zshplugin

    # This is a calculator which runs on zsh.
    arzzen/calc.plugin.zsh

    # zsh plugin to change directory to git repository root directory.
    mollifier/cd-gitroot

    # Optimized and extended zsh-syntax-highlighting.
    zdharma/fast-syntax-highlighting

    # zsh plugin for murdering node proc families.
    vmattos/kill-node

    # Wrappers for git commands to be efficient in the shell.
    seletskiy/zsh-git-smart-commands

    # ZSH plugin that reminds you to use existing aliases for commands you just typed.
    MichaelAquilina/zsh-you-should-use

    # Autocompletion support for `npm run`.
    akoenig/npm-run.plugin.zsh

    # Reminders about aliases I've set up.
    djui/alias-tips
EOBUNDLES

# Load the theme.
antigen theme tylerreckart/hyperzsh hyperzsh

# Tell Antigen that you're done.
antigen apply

# Git Aliases
alias c='git-smart-commit'
alias a='git-smart-add'
alias p='git-smart-push'
alias u='git-smart-pull'
alias r='git-smart-remote'

# Other aliases
alias proj='cd ~/projects'

export PATH=~/Library/Python/2.7/bin:$PATH
export EDITOR='/Applications/Visual Studio Code.app'
export VISUAL='/Applications/Visual Studio Code.app'
export HISTSIZE=100000
export SAVEHIST=100000
dontlaugh commented 6 years ago

I feel like I'm experiencing something similar when re-sourcing ~/.zshrc.

Upon opening a new terminal, the first load is fine. But if I run source ~/.zshrc I get the following output, and then it hangs indefinitely.

Seems robbyrussell/oh-my-zsh is already installed!    
Seems robbyrussell/oh-my-zsh is already installed!  
Seems robbyrussell/oh-my-zsh is already installed!  
Seems robbyrussell/oh-my-zsh is already installed!     
Seems robbyrussell/oh-my-zsh is already installed!   
Seems robbyrussell/oh-my-zsh is already installed!   
Seems zsh-users/zsh-syntax-highlighting is already installed!  
Seems robbyrussell/oh-my-zsh is already installed!   

My .zshrc file looked like this:

#!/bin/zsh
source ~/.config/antigen.zsh
antigen use oh-my-zsh
antigen bundle git
antigen bundle heroku
antigen bundle pip
antigen bundle lein
antigen bundle command-not-found
antigen bundle zsh-users/zsh-syntax-highlighting
antigen theme clean
antigen apply
export PATH=/usr/local/bin:/usr/local/sbin:${PATH}
export PATH=$PATH:~/.cargo/bin
export PATH=$PATH:~/bin
export RBENV_ROOT=/usr/local/var/rbenv

Update removing the antigen theme clean gets my prompt back. My terminal wasn't actually frozen, it was merely lacking a prompt. Of course now it's unthemed.

arowla commented 6 years ago

I've been experiencing this issue, too. The problem can be reproduced simply by running antigen theme <themename> at the terminal.

ustcyue commented 5 years ago

same here, antigen theme is causing the problem.

mtyler commented 5 years ago

happening for me as well. Fortunately, it only hangs when trying to apply the same theme so...

replacing

antigen theme candy #or whatever

with

# workaround for https://github.com/zsh-users/antigen/issues/675
THEME=denysdovhan/spaceship-prompt 
antigen list | grep $THEME; if [ $? -ne 0 ]; then antigen theme $THEME; fi

allowed me to source .zshrc

soullivaneuh commented 5 years ago

Thanks a lot for the workaround @mtyler, it works like a charm! :+1:

soullivaneuh commented 5 years ago

@mtyler Erf, not working corretly at the end:

~ at ☸️  microk8s 
➜ source ~/.zshrc
_arguments:comparguments:325: can only be called from completion function
_arguments:comparguments:325: can only be called from completion function
denysdovhan/spaceship-prompt @ master
sullivan@sweethome:~% 

The theme disappear on a reload. Any idea of why?

Here is my config file:

source ~/.shrc

if [[ ! -a ~/.antigen/antigen.zsh ]]; then
    git clone --branch master git@github.com:zsh-users/antigen.git ~/.antigen
    # @see https://github.com/zsh-users/antigen/issues/583
    cd ~/.antigen && git checkout v2.0.2 && cd -
fi
source ~/.antigen/antigen.zsh

antigen use oh-my-zsh

antigen bundles <<EOBUNDLES
    capistrano
    cp
    emoji
    fzf
    git
    helm
    history
    sudo
    $HOME/.zsh_custom/plugins/palette
    $HOME/.zsh_custom/plugins/skaffold
    wfxr/forgit
    zsh-users/zsh-autosuggestions
    zsh-users/zsh-syntax-highlighting
EOBUNDLES

# @see https://github.com/zsh-users/antigen/issues/675
THEME=denysdovhan/spaceship-prompt
antigen list | grep ${THEME}; if [[ $? -ne 0 ]]; then antigen theme ${THEME}; fi

antigen apply

HYPHEN_INSENSITIVE="true"
HIST_STAMPS="yyyy-mm-dd"

setopt HIST_IGNORE_ALL_DUPS

alias zshreload="source $HOME/.zshrc"

# ctrl+space key binding for auto-suggestion
bindkey '^ ' autosuggest-accept
soullivaneuh commented 5 years ago

The issue seems to come from denysdovhan/spaceship-prompt theme.

If I use antigen theme pure instead, it works like a charm.

artivilla commented 5 years ago

Is this issue been resolved, I'm having issues on reload and getting the following:

/Users/artichandok/.zshrc:4: command not found: antigen-use
/Users/artichandok/.zshrc:5: command not found: antigen-bundle
/Users/artichandok/.zshrc:8: command not found: antigen-bundle
/Users/artichandok/.zshrc:14: command not found: antigen-bundle
/Users/artichandok/.zshrc:15: command not found: antigen-bundle
/Users/artichandok/.zshrc:25: command not found: antigen-apply

Here's my .zshrc file:

ZSHA_BASE=$HOME
source $ZSHA_BASE/.zsh-antigen/antigen.zsh

Any ideas? I'm using the nightly version.

nicofuccella commented 4 years ago

+1

robsondealmeida commented 4 years ago

+1

Leeiio commented 4 years ago

+1

ryparker commented 4 years ago

For now, I was able to get around this by replacing theme with bundle:

# antigen theme denysdovhan/spaceship-prompt
antigen bundle denysdovhan/spaceship-prompt

I still see a long list of Seems robbyrussell/oh-my-zsh is already installed! however at least the theme loads back after using source ~/.zshrc

willzhqiang commented 4 years ago

happening for me as well. Fortunately, it only hangs when trying to apply the same theme so...

replacing

antigen theme candy #or whatever

with

# workaround for https://github.com/zsh-users/antigen/issues/675
THEME=denysdovhan/spaceship-prompt 
antigen list | grep $THEME; if [ $? -ne 0 ]; then antigen theme $THEME; fi

allowed me to source .zshrc

Thanks very much, it resolves my problem.

yangxyo commented 4 years ago

happening for me as well. Fortunately, it only hangs when trying to apply the same theme so...

replacing

antigen theme candy #or whatever

with

# workaround for https://github.com/zsh-users/antigen/issues/675
THEME=denysdovhan/spaceship-prompt 
antigen list | grep $THEME; if [ $? -ne 0 ]; then antigen theme $THEME; fi

allowed me to source .zshrc

Yes, I use this way to resolve the "hangs indefinitely" after exec "source ~/.zshrc. But, the new error comes. Time and again, when I open a new tab, it will show "You don't have any bundles", and every time after I exec antigen reset.

okgolove commented 4 years ago

The issue still exists

Quareia commented 3 years ago

Use exec zsh instead of source ~/.zshrc works for me.

https://github.com/romkatv/powerlevel10k/blob/master/README.md#weird-things-happen-after-typing-source-zshrc

mik3h0 commented 2 years ago

If anyone's using powerlevel9k or powerlevel10k and gets an instant prompt warning when using this method:

THEME=denysdovhan/spaceship-prompt 
antigen list | grep $THEME; if [ $? -ne 0 ]; then antigen theme $THEME; fi

You can do this instead:

THEME=romkatv/powerlevel10k
[[ `antigen list | grep $THEME | wc -l` -gt 0 ]] || antigen theme $THEME
xkz0777 commented 1 year ago

Use exec zsh instead of source ~/.zshrc works for me.

https://github.com/romkatv/powerlevel10k/blob/master/README.md#weird-things-happen-after-typing-source-zshrc

work for me too, thanks very much!