oblitum/rainbow — pull request #13 by rvesse (2014-09-18 13:30:35+00:00)
Title: Improve interoperability with syntax plugins

The existing default behaviour of the plugin when the use has not specified `g:rainbow_load_separately` is to `autocmd` itself to the `syntax` event for all files and call its `load()` function. However if you have a syntax plugin (or more generally another plugin) that wants to interoperate with the Rainbow plugin and tries to manually configure the plugin by calling `load()` directly problems can occur due to this `autocmd`.

The firing of this `autocmd` happens after the syntax plugin runs and this overwrites the syntax plugins custom configuration with the default rainbow plugin configuration.

This leads to the syntax plugins configuration being effectively ignored and potentially breaking the syntax plugin where aspects of the rainbow plugin interfere with the syntax plugins own highlighting e.g. if the syntax plugin wants to highlight operators differently.

This commit changes the behaviour for the default case (no user configuration) to call a new `loadIfNone()` function which only loads the default configuration if no configuration has previously been loaded for the current buffer. This special casing is also applied in the case where the user has specified `g:rainbow_load_separately` as otherwise a mapping for `*` could still interfere with other plugins behaviour.