Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup paths after variables have been initialized #372

Closed
wants to merge 2 commits into from

Conversation

fbergroth
Copy link

I noticed ~/.zplug/bin was not in my $PATH when using zplug --self-manage. It turned out $ZPLUG_BIN was empty because __zplug::core::core::variable hadn't been called.

On a sidenote, ${ZPLUG_ROOT:+"$ZPLUG_ROOT/bin"} adds ~/.zplug/repos/zplug/zplug/bin to the path with zplug --self-manage. Is that intended? Otherwise it seems to equal $ZPLUG_BIN, which makes it redundant.

@zakame
Copy link

zakame commented Mar 16, 2017

Ran into this as well, seems this PR fixes it.

@ghost
Copy link

ghost commented Mar 27, 2017

$ZPLUG_ROOT/bin will not be added to$PATH if the user is setting $ZPLUG_BIN.

@zakame
Copy link

zakame commented Mar 27, 2017

@39e I'm not setting $ZPLUG_BIN anywhere in my zsh init, yet $ZPLUG_ROOT/bin is not added.

To illustrate, here's my minimal ~/.zshrc:

[[ -d ~/.zplug ]] || {
    git clone https://github.com/zplug/zplug.git ~/.zplug
    source ~/.zplug/init.zsh
}

source ~/.zplug/init.zsh

zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "zsh-users/zsh-history-substring-search", defer:2
zplug "zsh-users/zsh-completions"
zplug "zsh-users/zsh-autosuggestions", defer:2

zplug "junegunn/fzf-bin", as:command, from:gh-r, use:"*linux*amd64*", rename-to:fzf
zplug "junegunn/fzf", as:command, use:"bin/fzf-tmux", rename-to:fzf-tmux
zplug "junegunn/fzf", use:"shell/*.zsh", defer:2

zplug "nojhan/liquidprompt"

zplug "lib/misc", from:oh-my-zsh
zplug "lib/termsupport", from:oh-my-zsh
zplug "lib/theme-and-appearance", from:oh-my-zsh

zplug "zplug/zplug", hook-build:"zplug --self-manage"

zplug "b4b4r07/enhancd", use:enhancd.sh
zplug "pipeseroni/pipes.sh", as:command, use:pipes.sh

zplug "joeyh/myrepos", as:command, use:mr
zplug "github/hub", as:command, from:gh-r, use:"*linux*amd64*"
zplug "plugins/github", from:oh-my-zsh
zplug "plugins/git", from:oh-my-zsh

zplug "mapio/tmux-tail-f", as:command, use:tmux-tail-f

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

zplug load

I'm using zplug "zplug/zplug", hook-build:"zplug --self-manage". At first install, ~/.zplug/bin is in the $path as well as ~/.zplug/repos/zplug/zplug/bin, and $ZPLUG_ROOT is set to ~/.zplug; but subsequent logins now set it it to ~/.zplug/repos/zplug/zplug, and removes ~/.zplug/bin, retaining only ~/.zplug/repos/zplug/zplug/bin:

⌂123% [zakame@yoshi:~] % rm -fr ~/.zplug ~/.zcompdump 
⌂123% [zakame@yoshi:~] % exec /bin/zsh -l
Cloning into '/home/zakame/.zplug'...
remote: Counting objects: 5187, done.
remote: Total 5187 (delta 0), reused 0 (delta 0), pack-reused 5187
Receiving objects: 100% (5187/5187), 1.04 MiB | 0 bytes/s, done.
Resolving deltas: 100% (3225/3225), done.
Checking connectivity... done.
- nojhan/liquidprompt: not installed
- junegunn/fzf: not installed
- zsh-users/zsh-completions: not installed
- joeyh/myrepos: not installed
- lib/termsupport: not installed
- junegunn/fzf-bin: not installed
- zsh-users/zsh-autosuggestions: not installed
- zsh-users/zsh-syntax-highlighting: not installed
- pipeseroni/pipes.sh: not installed
- b4b4r07/enhancd: not installed
- zsh-users/zsh-history-substring-search: not installed
- lib/theme-and-appearance: not installed
- plugins/github: not installed
- mapio/tmux-tail-f: not installed
- github/hub: not installed
- zplug/zplug: not installed
- lib/misc: not installed
- plugins/git: not installed
Install? [y/N]: y
[zplug] Start to install 18 plugins in parallel

 ✔  Installed!            zsh-users/zsh-completions
 ✔  Installed!            nojhan/liquidprompt
 ✔  Installed!            joeyh/myrepos
 ✔  Installed!            junegunn/fzf-bin
 ✔  Installed!            lib/termsupport
 ✔  Installed!            zsh-users/zsh-syntax-highlighting
 ✔  Installed!            zsh-users/zsh-autosuggestions
 ✔  Installed!            b4b4r07/enhancd
 ✔  Installed!            pipeseroni/pipes.sh
 ✔  Installed!            junegunn/fzf
 ✔  Installed!            zsh-users/zsh-history-substring-search
 ✔  Installed!            lib/theme-and-appearance
 ✔  Installed!            plugins/github
 ✔  Installed!            zplug/zplug --> hook-build: success
 ✔  Installed!            github/hub
 ✔  Installed!            mapio/tmux-tail-f
 ✔  Installed!            lib/misc
 ✔  Installed!            plugins/git

[zplug] Elapsed time: 5.6064 sec.
 ==> Installation finished successfully!
[zakame@yoshi:~] % print -l $path
/home/zakame/.plenv/shims
/home/zakame/.plenv/bin
/home/zakame/.zplug/bin
/home/zakame/.zplug/repos/zplug/zplug/bin
/usr/local/bin
/usr/bin
/bin
/usr/games
[zakame@yoshi:~] % zplug-env
ZPLUG_ROOT = /home/zakame/.zplug
ZPLUG_HOME = /home/zakame/.zplug
ZPLUG_PROTOCOL = HTTPS
ZPLUG_FILTER = fzf-tmux:fzf:peco:percol:fzy:zaw
ZPLUG_LOADFILE = /home/zakame/.zplug/packages.zsh
ZPLUG_USE_CACHE = true
ZPLUG_ERROR_LOG = /home/zakame/.zplug/.error_log
ZPLUG_BIN = /home/zakame/.zplug/bin
ZPLUG_CACHE_DIR = /home/zakame/.zplug/cache
ZPLUG_REPOS = /home/zakame/.zplug/repos
_ZPLUG_VERSION = 2.4.1
_ZPLUG_URL = https://github.com/zplug/zplug
_ZPLUG_OHMYZSH = robbyrussell/oh-my-zsh
_ZPLUG_PREZTO = sorin-ionescu/prezto
_ZPLUG_AWKPATH = /home/zakame/.zplug/misc/contrib
_ZPLUG_CONFIG_SUBSHELL = :
ZPLUG_THREADS = 16
ZPLUG_SUDO_PASSWORD = 
[zakame@yoshi:~] % 
Connection to yoshi closed.
⌂89% θ96° [zakame:~] 1m53s % ssh yoshi

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have old mail.
[zakame@yoshi:~] % print -l $path
/home/zakame/.plenv/shims
/home/zakame/.plenv/bin
/home/zakame/.zplug/repos/zplug/zplug/bin
/usr/local/bin
/usr/bin
/bin
/usr/games
[zakame@yoshi:~] % zplug-env
ZPLUG_ROOT = /home/zakame/.zplug/repos/zplug/zplug
ZPLUG_HOME = /home/zakame/.zplug
ZPLUG_THREADS = 16
ZPLUG_PROTOCOL = HTTPS
ZPLUG_FILTER = fzf-tmux:fzf:peco:percol:fzy:zaw
ZPLUG_LOADFILE = /home/zakame/.zplug/packages.zsh
ZPLUG_USE_CACHE = true
ZPLUG_ERROR_LOG = /home/zakame/.zplug/.error_log
ZPLUG_BIN = /home/zakame/.zplug/bin
ZPLUG_CACHE_DIR = /home/zakame/.zplug/cache
ZPLUG_REPOS = /home/zakame/.zplug/repos
_ZPLUG_VERSION = 2.4.1
_ZPLUG_URL = https://github.com/zplug/zplug
_ZPLUG_OHMYZSH = robbyrussell/oh-my-zsh
_ZPLUG_PREZTO = sorin-ionescu/prezto
_ZPLUG_AWKPATH = /home/zakame/.zplug/repos/zplug/zplug/misc/contrib
_ZPLUG_CONFIG_SUBSHELL = :

@mruwek
Copy link

mruwek commented Mar 31, 2017

PR above fixes the most important issue mentioned here, but read on.

@39e

$ZPLUG_ROOT/bin will not be added to $PATH if the user is setting $ZPLUG_BIN

Erm, nope:
https://github.com/zplug/zplug/blob/master/base/core/core.zsh#L97

As You can see on this line $ZPLUG_ROOT/bin is added if $ZPLUG_ROOT is not null (i.e. always).

README says:

ZPLUG_BIN
Defaults to $ZPLUG_HOME/bin.

Current implementation installs commands properly (i.e in default value of $ZPLUG_BIN), but doesn't add that default to the $PATH, because defaults are evaluated afterwards.

Both issues (unneeded $ZPLUG_ROOT/bin and not adding default value of $ZPLUG_BIN if it is not set explicitly by the user) is resolved by #389.

Prefer usage of $ZPLUG_BIN and use $ZPLUG_ROOT/bin as a fallback.
@mruwek mruwek mentioned this pull request Mar 31, 2017
zakame added a commit to zakame/dotfiles that referenced this pull request Apr 3, 2017
`zplug --self-manage` isn't working for me now, so leave it out for the
time being, until zplug/zplug#387 gets resolved (e.g. via
zplug/zplug#372)
@thiagowfx
Copy link

thiagowfx commented Apr 30, 2017

Any updates on this? Is there anything else missing here for this PR to be merged?

@fbergroth
Copy link
Author

Yes, it's ready. Ping @b4b4r07

@fbergroth
Copy link
Author

Whatever

@fbergroth fbergroth closed this Jun 6, 2017
@zakame
Copy link

zakame commented Jun 6, 2017

What happened?

@fbergroth
Copy link
Author

Closed due to lack of response from project maintainers

@mruwek
Copy link

mruwek commented Jun 11, 2017

@b4b4r07
Hey, what's going on here, huh? I can understand lack of time for project. I can understand difficulties with reproducing issues on different machines/environments. I can also understand reluctance for merging "crazy-new-awesome-feature" that has 1 very vocal advocate. What I don't understand is ignoring user-made fix for a bug. If you don't like the solution, please tell us. If you don't care, and/or don't have time for maintenance, please tell us. But ignoring user supplied bug-fixes for real bugs is just rude.

@thiagowfx
Copy link

thiagowfx commented Jun 11, 2017

Yeah, that's sad. I completely stopped using zplug too, just because of that. There are lots of other zsh plugin managers out there that are better maintained. The problem is not lack of time, this can happen, everyone is busy these days!

The problem is that we have the opposite of content over form here. There was a lot of effort to create a great README (with badges, gifs, pros, images, docs) to attract new users, but there is a very little effort to maintain issues (=to retain these users); it is disproportionate. I'd rather see a poor README in exchange for a stable, solid and well-maintained software.

I can totally understand why @fbergroth got pissed off. Anyway, if you are reading this, Fredrik, thanks for your work anyway. Let's move on.

@fbergroth
Copy link
Author

Hey, thanks for your replies.

I'm not upset, and don't really mind that this project isn't well maintained. It's easy to fork it if anyone wishes to do so.

As @thiagowfx, I've moved on too, and just don't want to deal with this PR anymore.

pinelibg added a commit to pinelibg/dotfiles that referenced this pull request Dec 24, 2017
@pinelibg pinelibg mentioned this pull request Jan 20, 2018
4 tasks
@ev0rtex
Copy link

ev0rtex commented Feb 6, 2018

This seems so simple and while it's not really difficult I really don't want to have to maintain my own fork if I can avoid it (probably will for now anyway though). If this could get merged at some point it would be awesome!

@ELLIOTTCABLE
Copy link

@ev0rtex thanks for creating a fork with this patch merged! Would you mind merging in a few other long-standing / critical fixes? Perhaps #430, #429, #396, #455

Although you did say you don't want to maintain a fork, welp. Just a thought!

@ev0rtex
Copy link

ev0rtex commented Feb 11, 2018

@ELLIOTTCABLE simple enough...I just merged those ones into my fork. FYI, I also forked the installer script so I could use that to install from my fork (my fork is here)

@martisj
Copy link

martisj commented Mar 1, 2018

And how might one use your fork @ev0rtex ? I have tried: git clone https://github.com/ev0rtex/zplug ~/.zplug
Is that it?

@ELLIOTTCABLE
Copy link

(Looks like self-management needs a little work, too — might as well abstract it so any fork can self-manage. I've got a local branch where I'm working on that, but won't have time to PR for a while, unfortunately …)

@ev0rtex
Copy link

ev0rtex commented Mar 2, 2018

@ELLIOTTCABLE I'd be curious what approach you're taking...I think the ability for any fork to self manage would be awesome

@ev0rtex
Copy link

ev0rtex commented Mar 2, 2018

@martisj Assuming I modified all the correct references in my fork of the installer you could probably just add something to the top of your ~/.zshrc like I did that uses the installer to install it:

~/.zshrc

# ------------------------------------------------------- #
#                          Zplug                          #
# ------------------------------------------------------- #
export ZPLUG_HOME="${HOME}/.zplug"

[ -d "${ZPLUG_HOME}" ] || curl -fsSL --proto-redir -all,https https://raw.githubusercontent.com/ev0rtex/zplug-installer/master/installer.zsh | zsh
source "${ZPLUG_HOME}/init.zsh"

# ------------------------------------------------------- #
#                         Plugins                         #
# ------------------------------------------------------- #
zplug "zplug/zplug", hook-build:"zplug --self-manage"

# Custom modules/scripts
zplug "~/.zsh/config/0",                        use:"*.zsh", from:local, defer:0
zplug "~/.zsh/config/1",                        use:"*.zsh", from:local, defer:1
zplug "~/.zsh/config/2",                        use:"*.zsh", from:local, defer:2
zplug "~/.zsh/config/3",                        use:"*.zsh", from:local, defer:3

# Theme
zplug "bhilburn/powerlevel9k",                  use:"powerlevel9k.zsh-theme", as:theme

.
.
.

@lvh lvh mentioned this pull request Mar 26, 2018
4 tasks
@babarot babarot reopened this May 12, 2018
@babarot
Copy link
Member

babarot commented May 12, 2018

Sorry for late response. Nice work @fbergroth but it's conflicted now..

@babarot
Copy link
Member

babarot commented May 12, 2018

Ahh, I found similar PR in #476

So I'll merge it into master.

@babarot babarot closed this May 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants