zsh-users / antigen

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

Antigen is trying to find .zshrc in home folder after moving It to new directory #722

Open thales-maciel opened 3 years ago

thales-maciel commented 3 years ago

Description

Antigen is trying to find .zshrc in home folder after moving It to new directory and declaring new ZDOTDIR in .zshenv (located in home).

From time to time (usually when I open my second shell after logging in), I lose my prompt and all my plugins, but everything else located in my .zshrc still works (sourcing aliases, scripts, LS_COLORS and so on).

When trying to source my .zshrc manually in this terminal I got the default antigen messages saying that my plugins are installed, but I'm still not able to use them untill I do antigen reset and open a new shell.

This new shell now says: -antigen-cache-generate:zcompile:65: can't open file: /home/<my-username>/.zshrc, but this time all my plugins are correctly sourced and ready to use.

This behavior is still happening after complete re-install and deleting the .zwc and .zcompdump files.

Steps to reproduce

1 - Change ZDOTDIR in ~/.zshenv
2 - Move files there
3 - Open new terminal (maybe restart)

Expected behavior:

All plugins should be available without needing to reset antigen.

Software version

Configuration

typeset -U PATH path

export LANGUAGE=en_US.UTF-8

# ~/ Clean-up:
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"

# Default Apps
export TERMINAL="alacritty"
export EDITOR="nvim"
export VISUAL="nvim"

# Other program settings:
export FZF_DEFAULT_OPTS="--layout=reverse --height 40%"

export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"

export ADOTDIR="${ZDOTDIR}/antigen"

path=(~/.local/bin ~/scripts $path)

Default repo (oh-my-zsh).

antigen bundle git antigen bundle lein antigen bundle extract antigen bundle command-not-found antigen bundle zsh-interactive-cd

External repos.

antigen bundle zsh-users/zsh-completions antigen bundle zsh-users/zsh-autosuggestions antigen bundle zsh-users/zsh-syntax-highlighting antigen bundle wfxr/forgit

Prompt theme.

antigen bundle denysdovhan/spaceship-prompt

Apply

antigen apply


- gist of `.zshrc`:
``` shell
LS_COLORS=$LS_COLORS:'ow=01;34:' ; export LS_COLORS

SPACESHIP_PROMPT_ORDER=(
  time
  #user          # Username section
  venv
  dir           # Current directory section
  host          # Hostname section
  git           # Git section (git_branch + git_status)
  hg            # Mercurial section (hg_branch  + hg_status)
  node
  ruby
  golang
  rust
  docker
  conda
  pyenv
  exec_time     # Execution time
  line_sep      # Line break
  vi_mode       # Vi-mode indicator
  jobs          # Background jobs indicator
  exit_code     # Exit code section
  char          # Prompt character
)

SPACESHIP_USER_SHOW="always" # Shows System user name before directory name

SPACESHIP_PROMPT_ADD_NEWLINE=true
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true

SPACESHIP_CHAR_SYMBOL="⮞"
SPACESHIP_CHAR_SUFFIX=" "

SPACESHIP_DIR_PREFIX=''
# SPACESHIP_DIR_TRUNC=1 # Shows only the last directory folder name

SPACESHIP_VENV_PREFIX="("
SPACESHIP_VENV_SUFFIX=") "
SPACESHIP_VENV_GENERIC_NAMES=false

[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh  # This loads NVM

# Load Antigen
source ${ZDOTDIR:-~}/antigen.zsh # this depends on where you saved the file

# Load Antigen Configurations
antigen init ${ZDOTDIR:-~}/.antigenrc

#fzf
source /usr/share/doc/fzf/examples/key-bindings.zsh
source /usr/share/doc/fzf/examples/completion.zsh

fpath+=${ZDOTDIR:-~}/.zsh_functions

# Aliases
if [[ -r ${ZDOTDIR:-~}/.aliases ]]; then
  . ${ZDOTDIR:-~}/.aliases
fi

# Hide % on start
unsetopt PROMPT_SP

More information

thales-maciel commented 3 years ago

Update

Added the line: typeset -a ANTIGEN_CHECK_FILES=(${ZDOTDIR:-~}/.zshrc ${ZDOTDIR:-~}/antigen.zsh) before sourcing antigen.zsh in my .zshrc.

Now the behavior is the same, but I no longer see this message: -antigen-cache-generate:zcompile:65: can't open file: /home/<my-username>/.zshrc, so that's a start...

I can reproduce this very easily now, I just have to open a terminal inside pycharm and then open another one in my terminal.

Every time I open a new terminal inside pycharm, I see all the installing messages, I tested in vscode and It doesn't happens there.