Skip to content
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

Fix colorscheme switching problems at template level #3

Closed
lifepillar opened this issue Nov 1, 2017 · 3 comments
Closed

Fix colorscheme switching problems at template level #3

lifepillar opened this issue Nov 1, 2017 · 3 comments
Labels

Comments

@lifepillar
Copy link
Owner

lifepillar commented Nov 1, 2017

(Original issue from @jordwalke at #2)

You might take a look at @xolox's comment here about some known issues with colorscheme switching. If creating a template for other plugins to be based on, there might be some problems with colorscheming you can fix at the template level.

@lifepillar lifepillar mentioned this issue Nov 1, 2017
@lifepillar
Copy link
Owner Author

@tpope's comment is spot on there.

As things stand currently, the only "clean" way to fix the issue of messed up highlighting after color switching is to avoid overriding the highlighting of syntax files in colorschemes entirely.

I see two ways to encourage colorscheme developers to follow such a policy in templates:

  1. Raise a warning every time a highlight group different from the "core" ones is defined;

  2. Put a conditional block in the default templates, along these lines:

    verbatim
    if get(g:, '@optionprefix_enable_syntax_hi_groups', 0) " Skip this block by default
      " Highlight groups for syntax highlighting are defined here
    endif
    endverbatim

    preceded by a comment explaining why defining syntax highlight groups in a colorscheme is a bad idea. The two are not mutually exclusive, of course.

@lifepillar
Copy link
Owner Author

I have added a “Best practices” section to Colortemplate's help file recommending, among the rest, to avoid filetype-specific highlight groups or to define them conditionally.

As far as I can see, this issue not solvable in other ways (except by plugins like colorscheme-switcher—no idea how effective they are, though), not unless something changes in Vim. I will leave this open for the time being, in case someone comes with a better idea.

@lifepillar
Copy link
Owner Author

Closing, because this issue has been fixed in Vim (vim/vim#4405).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant