TaDaa / vimade

An eye friendly plugin that fades your inactive buffers and preserves your syntax highlighting!
MIT License
486 stars 8 forks source link

[Feature request] Support special highlight groups. #40

Open kevinhwang91 opened 4 years ago

kevinhwang91 commented 4 years ago

Some SynID can't get by function synID({lnum}, {col}, {trans}), such as Search and other Plugins like semshi add highlight by nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line}, {col_start}, {col_end}). I think this feature can't cause any performance issue, please correct me if I was wrong.

Here is the issue recording by asciinema. https://asciinema.org/a/297762

If you want to support this feature, please enable special highlight groups by filetype because not only python but others plugins can invoke nvim_buf_add_highlight

TaDaa commented 4 years ago

I will say for search vimade.fadepriority can be used to show Search highlights (the default setting hides them), but Search will not fade. Search should be supported w/ fading for Neovim when I get to #26 as set winhl should work (I should get to this soon).

I'll look into supporting other special highlight groups like the nvim_buf_add_highlight that you mentioned, but I'm not sure they can currently be introspected (same thing with virtual text).

kevinhwang91 commented 4 years ago

I don't think any neovim'api can solve the issue at present. Maybe give power to the user to write down the highlight group into vimade configuration.

TaDaa commented 4 years ago

Looks like virtualtext is now inspectable by nvim_get_virtual_text() -- I'll try to add support for this one at some point.

For winhl there will be vimade.basegroups property exposed for neovim to override highlights. However the caveat is that Neovim only allows certain built-in highlights to be overridden. So this may (not 100% sure) work for nvim_buf_add_highlight only if the highlight groups are linked to built-in ones. It would be awesome if Neovim opened up winhl to other highlights -- I may open an issue for this, but they may also have reasons for limiting it.

Still thinking about how to fully support nvim_buf_highlight, but here are a several possibilities:

There might be another issue as I don't see documentation for priority for nvim_buf_add_highlight. I'm not quite sure how well multiple plugins play together using that function (which plugin wins the UI display -- I'm guessing its the last caller), however this might lead to situations where fades are inconsistently displaying.

---edit--- Actually I think matchaddpos() wins over nvim_buf_add_highlight, so priority might be solved already -- will double check though

TaDaa commented 4 years ago

Commit above addresses Search

vimade.basegroups can now be used to customize built-in highlighting; its pre-initialized with ['Folded', 'Search', 'SignColumn', 'LineNr', 'CursorLine', 'CursorLineNr', 'DiffAdd', 'DiffChange', 'DiffDelete', 'DiffText', 'FoldColumn', 'Whitespace'].

For fading Search, just set vimade.fadepriority=0 and it should now be good to go.