-
Notifications
You must be signed in to change notification settings - Fork 197
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
Improve startup time by hard-coding the 256 color #93
Conversation
This is an awesome compromise between the flexible original approach and your idea in #74 that retains the ongoing maintainability of the current repo. Nice! |
Thanks a lot for your contribution and sorry this has been taken into account so late, life has been pretty busy and I must admit that I did not spend much time on this repo. |
@laggardkernel IncSearch doesn't work properly. Fixed by - hi! link IncSearch OneHue6
+ call <sid>X('IncSearch', s:hue_6, '', '') |
`hi! link` overrides another `hi link` but not a `hi` def. Cause some defs may defined by default, use `hi` to override them. `hi` def all the builtin groups may be a much safer way. Check `:h highlight-groups` or `:highlight-default`. rakr#93 (comment)
- `hi clear` loads default groups but `hi clear IncSearch` not - `hi` inherits existing group and override it, while `hi! link` existing groups rakr#93 (comment)
@kevinhwang91 Sorry, haven't used vim for a long time. After some reading, I found the cause
Only a quick fix removing problematic hi clear
hi! link
check
The default def is ignored, only linked group is used, so the text (foreground) is OneHue6. hiIf we use
Group def is merged with the default one, the background color is OneHue6. |
vim-one
converts the color hex code to 256 color code inhighlight
command wrapper function called<sid>X(group, fg, bg, attr)
. The unnecessary calculation in all of its 380+highlight
definitions makesvim-one
one of the slowest vim colorschemes.I realized this from the explanation made by @geoffharcourt at issue #74 . Someone reported the slow startup caused by
vim-one
in issue #84 as well.In my experiment, I removed the conversion, hard-coded the closest 256 color code, defined a new
hi
wrapper for highlight definition. It turns out that this improves the startup time hugely.At the same time, the original
hi
wrapper function<sid>X(group, fg, bg, attr)
is kept for user customization.vim-one
loading timehi
statements directlyThe final result
34 ms
is acceptable, consideringvim-one
uses so manyhighlight
definitions.Credit
highlight
(:help hi
) command wrapper is borrowed from Vim theme oceanic-next.