Giter Club home page Giter Club logo

Comments (18)

frm avatar frm commented on July 16, 2024 1

I just created #144, to wrap up this subject and avoid any further confusion. Afterwards, yeah, let's just close it.

from geometry.

desyncr avatar desyncr commented on July 16, 2024

It seems you have loading geometry twice. What's your zshrc/zplug configuration?

from geometry.

frm avatar frm commented on July 16, 2024

I actually have a suggestion regarding this but I'm afraid I'm nitpicking. I have on my dotfiles alias reload="source ~/.zshrc" to reload configs when I change them and that always sets me off because of the "Error". It always seems like I screwed up something. At the very least can we change it to "Warning" or equivalent?

from geometry.

desyncr avatar desyncr commented on July 16, 2024

Yes I agree. I haven't put much though on the "Error:" string.

from geometry.

fnky avatar fnky commented on July 16, 2024

My .zshrc

TERM=xterm-256color

# shortcut to this dotfiles path is $ZSH
export ZSH=$HOME/.dotfiles

# your project folder that we can `c [tab]` to
export PROJECTS=~/Documents/Development

# Stash your environment variables in ~/.localrc. This means they'll stay out
# of your main dotfiles repository (which may be public, like this one), but
# you'll have access to them in your scripts.
if [[ -a ~/.localrc ]]
then
  source ~/.localrc
fi

# all of our zsh files
typeset -U config_files
config_files=($ZSH/**/*.zsh)

# load the path files
for file in ${(M)config_files:#*/path.zsh}
do
  source $file
done

# load everything but the path and completion files
for file in ${${config_files:#*/path.zsh}:#*/completion.zsh}
do
  source $file
done

# initialize autocomplete here, otherwise functions won't be loaded
autoload -Uz compinit && compinit

# load every completion after autocomplete loads
for file in ${(M)config_files:#*/completion.zsh}
do
  source $file
done

unset config_files

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

Which sources .localrc

export LSCOLORS="ExFxCxDxBxegedabaggcad"

autoload -U colors && colors
autoload -U promptinit

# Customize geometry
GEOMETRY_COLOR_GIT_DIRTY=9
GEOMETRY_COLOR_GIT_BRANCH=6
GEOMETRY_COLOR_EXIT_VALUE=9
GEOMETRY_COLOR_DIR=242
GEOMETRY_SYMBOL_EXIT_VALUE=""
PROMPT_GEOMETRY_GIT_CONFLICTS=true

and all shell scripts from .dotfiles directory including zplug.zsh

#!/bin/zsh
source ~/.zplug/init.zsh

has_plugin() {
  (( $+functions[zplug] )) || return 1
  zplug check "${1:?too few arguments}"
  return $status
}

# Remote plugins
zplug "glidenote/hub-zsh-completion"
zplug "frmendes/geometry"
zplug "zsh-users/zsh-completions"
zplug "zsh-users/zsh-history-substring-search"

if ! zplug check --verbose; then
  printf "Install? [y/N]: "
  if read -q; then
    echo; zplug install
  else
    echo
  fi
fi

# Source plugins and add commands to $PATH
zplug load # --verbose

from geometry.

desyncr avatar desyncr commented on July 16, 2024

I didn't tried the whole config just the zplug part and it worked without issues. Can you provide a minimal config where the issue still reproduces?

from geometry.

fnky avatar fnky commented on July 16, 2024

I couldn't figure out why it did it. I tried without loading any other files but zplug and it still wrote those warnings. I also tried only to load zplug + geometry without luck.

I have changed the line for loading zplug plugins to

zplug load > /dev/null

It isn't fixing the issue, but this will prevent it from showing up in stdout.

from geometry.

frm avatar frm commented on July 16, 2024
# load everything but the path and completion files
for file in ${${config_files:#*/path.zsh}:#*/completion.zsh}
do
  source $file
done

Are you sure this isn't loading geometry again?

from geometry.

fnky avatar fnky commented on July 16, 2024

Yeah I tried to comment out individual loops, and even echo the $file. It only loads zplug.zsh once and only within the loop you specified. I also tried without loops and sourcing zplug manually, same result.

from geometry.

jedahan avatar jedahan commented on July 16, 2024

Can you try a more minimal .zshrc, like:

export ZSH=$HOME/.dotfiles

typeset -U config_files
config_files=($ZSH/**/*.zsh)

for file in ${(M)config_files:#*/path.zsh}
do
  source $file
done

for file in ${${config_files:#*/path.zsh}:#*/completion.zsh}
do
  source $file
done

unset config_files

Its pretty tough for us to reproduce, because we would need the entire contents of your $HOME/.dotfiles to see if any of them are re-loading geometry...

from geometry.

kreedz avatar kreedz commented on July 16, 2024

I have same issue.
My .zshrc:

# zgen
source ~/.zgen/zgen.zsh
if ! zgen saved; then
    zgen load frmendes/geometry
    zgen save
fi

When I open my console it's ok. First time, second time and further.
But if manually source ~/.zshrc then I got:

Warning: Plugin exec_time already registered.
Warning: Plugin git already registered.

But if before source ~/.zshrc perform zgen reset than it doesn't give any warning.
zgen reset delete ~/.zgen/init.zsh.

My ~/.zgen/init.zsh (autogenerated):

# {{{
# Generated by zgen.
# This file will be overwritten the next time you run zgen save!

ZSH=/home/kreedz/.zgen/robbyrussell/oh-my-zsh-master

# ### General modules
source "/home/kreedz/.zgen/frmendes/geometry-master/geometry.plugin.zsh"

# ### Plugins & Completions
fpath=(/home/kreedz/.zgen/frmendes/geometry-master ${fpath})

autoload -Uz compinit && \
   compinit -C 
# }}}

And I noticed that ${fpath} starts to repeat (equal to the number of sourcing) the paths that mentioned in the ~/.zgen/init.zsh. It's normal?

Other plugins (zsh-users/zsh-autosuggestions, zsh-users/zsh-syntax-highlighting, oh-my-zsh plugins/{git,sudo}) works without warnings

I don't know it's zgen or geometry problem. Or even my problem that I'm doing something wrong.
But on the main page of zgen there a nothing about doing zgen reset before source ~/.zshrc

from geometry.

frm avatar frm commented on July 16, 2024

Manually sourcing .zshrc does give that error because you are effectively loading geometry again. As far as I can tell, this doesn't cause any issues and you should be clear to just ignore it. The error message was intended as a warning in case of faulty configuration but it's normal to happen when you reload all your shell configs.

from geometry.

jedahan avatar jedahan commented on July 16, 2024

How would we feel about unloading then reloading a plugin, instead of warning?

from geometry.

frm avatar frm commented on July 16, 2024

Is it worth it, though? It's the intended behaviour based on how shells work. If you put PATH=$HOME/.bin:$PATH in your .zshrc and then source it again, the PATH variable will contain $HOME/.bin twice. It doesn't clear the environment. Because of that, I'm not keen on doing it by hand. Especially since we would be adding code to handle a very specific issue which isn't really an issue and doesn't break anything. It's more of a consequence of external code (the shell) acting like it's supposed to.

Maybe change the warning message? But even that, it's supposed to inform users when they do something wrong while building a custom plugin. There's not a clear way to distinguish errors while making custom plugins and a source .zshrc.

from geometry.

jedahan avatar jedahan commented on July 16, 2024

Yeah I think as long as we are writing to stderr, it's a good idea to keep the current behaviour. The warning is helpful and harmless, made for humans.

from geometry.

desyncr avatar desyncr commented on July 16, 2024

@frmendes @jedahan I think the actionable now is to better handle error/warning messages. Currently we have writing everything to stdout, ex: https://github.com/frmendes/geometry/blob/master/lib/plugin.zsh#L30
I'm gonna create a new issue for this.

I believe we can close this for now then, @frmendes Should I?

from geometry.

sheharyarn avatar sheharyarn commented on July 16, 2024

The git plugin stops working whenever I re-source my zshrc. Can I stop Geometry from loading again if it's already loaded?

image

(Gif: https://jmp.sh/AynbK0p)

My .zshrc: https://github.com/sheharyarn/dotfiles/blob/master/Zsh/zshrc.symlink

from geometry.

jedahan avatar jedahan commented on July 16, 2024

@sheharyarn unfortunately since you are sourcing geometry from oh-my-zsh, I am not sure how to tell OMZ how to not source geometry.zsh.

In addition these are warnings that can be safely ignored. We will soon be releasing a version of geometry that will no longer have these warnings.

from geometry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.