zplug/zplug

zsh-users/zsh-syntax-highlighting should be loaded at the end

leomao opened this issue · 7 comments

As metion in #24, zsh-syntax-highlighting should be loaded after loading all other plugins and compinit in order to update the syntax highlighting properly.

I am not sure whether this issue is only for zsh-syntax-highlighting or not.
If other plugins also wrap ZLE widget, then they may also need to be loaded in some order to work properly together.

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?

Images:

2015-12-07 11 32 04

2015-12-07 11 32 33

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

Sounds good to me. 👍

What a relief! Thanks.

The problem was solved. Please update zplug!

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.