Improve startup time by hard-coding the 256 color#93
Improve startup time by hard-coding the 256 color#93laggardkernel wants to merge 4 commits intorakr:masterfrom laggardkernel:new-hi-wrapper
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-oneconverts the color hex code to 256 color code inhighlightcommand wrapper function called<sid>X(group, fg, bg, attr). The unnecessary calculation in all of its 380+highlightdefinitions makesvim-oneone 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-onein issue #84 as well.In my experiment, I removed the conversion, hard-coded the closest 256 color code, defined a new
hiwrapper for highlight definition. It turns out that this improves the startup time hugely.At the same time, the original
hiwrapper function<sid>X(group, fg, bg, attr)is kept for user customization.vim-oneloading timehistatements directlyThe final result
34 msis acceptable, consideringvim-oneuses so manyhighlightdefinitions.Credit
highlight(:help hi) command wrapper is borrowed from Vim theme oceanic-next.