w0ng / vim-hybrid

A dark color scheme for Vim
1.48k stars 235 forks source link

Minor performance improvements #56

Open h3xx opened 1 year ago

h3xx commented 1 year ago

Don't use exists("g:...") then == to lookup globals, use one get(). This is faster.

Setting variables using exec only makes sense if the variable name comes from the value of another variable, not how it was being used. Aside from omitting dangerous behavior (exec =~ eval), it's slightly faster.

According to the documentation, this causes the color scheme to be loaded TWICE.

When a color scheme is loaded (the "g:colors_name" variable is set) setting 'background' will cause the color scheme to be reloaded. If the color scheme adjusts to the value of 'background' this will work.

However, if the color scheme sets 'background' itself the effect may be undone. First delete the "g:colors_name" variable when needed.

Essentially, color schemes should not set the value of &background.

I tested these changes on vim 8.0.1453 and they appeared to work with no syntax errors, and color scheme loaded correctly.