mg979 / vim-visual-multi

Multiple cursors plugin for vim/neovim
MIT License
4.22k stars 82 forks source link

Unable to integrate with colorscheme #175

Closed Shatur closed 3 years ago

Shatur commented 3 years ago

Describe the issue:

I trying to add highlighting groups to my theme. I did it exactly as specified in :h vm-colorschemes (e.g. I set g:VM_theme_set_by_colorscheme in theme file). But the colors are only applied if the colorscheme is loaded after vim-visual-multi. So If I set theme later, then colors from the theme will be applied. If the user is using a third party plugin manager, then this can be easily fixed by using the load order. But if the user uses the native (built-in) plugin manager from Vim8, then this becomes problematic.

Suggestion Currently the option g:VM_theme_set_by_colorscheme is not permanent and will be removed by plugin on applying theme. Usually such options are not typical for a plugin. I would suggest making this option permanent and completely disabling the theme engine if it is set.

mg979 commented 3 years ago

Can you try now? Note that now in your colorscheme you have to check for exists(':VMTheme'), not exists('g:loaded_visual_multi').

See :h vm-colorschemes

Shatur commented 3 years ago

Yes, it worked, thank you!

Should I really check for exists(':VMTheme')? I probably can just set this variable unconditionally.

mg979 commented 3 years ago

Should I really check for exists(':VMTheme')?

My mistake... It should work also with exists('g:loaded_visual_multi').

Edit: you can skip the check, but then highlight groups are also set if VM isn't loaded/used.

Shatur commented 3 years ago

Edit: you can skip the check, but then highlight groups are also set if VM isn't loaded/used.

Hm... Usually most colorschemes do not check for plugins when loading.

mg979 commented 3 years ago

Sure, it's up to you.