antigen icon indicating copy to clipboard operation
antigen copied to clipboard

source ~/.zshrc Permanently Messed Up Antigen

Open mssngr opened this issue 6 years ago • 18 comments

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:

  • Not having syntax errors or unknown conditions on terminal load

Software version

  • Antigen v2.2.2
  • zsh 5.5.1 (x86_64-apple-darwin17.5.0)
  • Darwin Gabriel-Konkles-MacBook.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

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

mssngr avatar Sep 13 '18 06:09 mssngr

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.

dontlaugh avatar Sep 27 '18 19:09 dontlaugh

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

arowla avatar Oct 03 '18 20:10 arowla

same here, antigen theme is causing the problem.

ustcyue avatar Dec 23 '18 12:12 ustcyue

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

mtyler avatar Jan 09 '19 16:01 mtyler

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

soullivaneuh avatar Feb 17 '19 19:02 soullivaneuh

@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 [email protected]: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 avatar Feb 17 '19 19:02 soullivaneuh

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

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

soullivaneuh avatar Feb 17 '19 19:02 soullivaneuh

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.

artivilla avatar Mar 19 '19 21:03 artivilla

+1

nicofuccella avatar Dec 30 '19 20:12 nicofuccella

+1

robsondealmeida avatar Jan 06 '20 22:01 robsondealmeida

+1

Leeiio avatar Mar 06 '20 08:03 Leeiio

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

ryparker avatar Mar 09 '20 15:03 ryparker

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.

willzhqiang avatar Apr 17 '20 06:04 willzhqiang

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.

yangxyo avatar Jun 16 '20 04:06 yangxyo

The issue still exists

okgolove avatar Jul 16 '20 19:07 okgolove

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

Quareia avatar Dec 05 '20 08:12 Quareia

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

mik3h0 avatar May 14 '22 14:05 mik3h0

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!

xkz0777 avatar Apr 05 '23 16:04 xkz0777