zsh-users/zsh-syntax-highlighting should be loaded at the end · Issue #26 · zplug/zplug

b4b4r07 added a commit that referenced this issue

Dec 7, 2015
- in order to solve #26 problem
- nice tag means loading priority/order
- range from -20 (highest) to 19 (lowest)

@b4b4r07

Hi @leomao

In order to solve this problem, I will suggest you to introduce new tag called nice:.

By using the nice tag, the zplug user can set the priority of the loading order of the plugins.

Priority levels of nice range from -20 (highest) to 19 (lowest) and defaults to 0. In addition, the plugins are loaded after running compinit command when the nice tag is 10 or larger.

# Make sure you use double quotes
zplug "zsh-users/zsh-history-substring-search"
# zplug ...  more plugins

# will run compinit -d "${ZPLUG_HOME}/zcompdump" at this line

zplug "zsh-users/zsh-syntax-highlighting", nice:19

zplug load # will load plugins in the order of nice tag

Would you let me know what you think about it?

@b4b4r07

If you looks good, I will continue to develop in this branch.

@leomao

@b4b4r07

@b4b4r07

The problem was solved. Please update zplug!

@leomao

Hi,
I am not sure whether I understood this mechanism correctly or not.

zplug A, nice:-20
zplug B, nice:-10
zplug C

The order will be A -> B -> C ?
It seems that the order is C -> B -> A actually.

I think this is caused by for key in ${${(on)nices}#*:}, since the numeric sort of zsh doesn't recognize minus sign as a part of number.

arr=(1 -1 0 2 -2)
echo ${(on)arr} # 0 1 -1 2 -2

Changing it to for key in ${${(OnM)nices:#-*}#*:} ${${(on)nices:#-*}#*:} will work.

b4b4r07 added a commit that referenced this issue

Dec 3, 2016

@b4b4r07