kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.23k stars 44 forks source link

Support inkarkat/vim-mark #76

Closed skt041959 closed 1 year ago

skt041959 commented 1 year ago

Feature description

This plugin vim-mark can highlight multiple words with different colors. image

But the highlight is not honored by ufo in the folded text. image

Describe the solution you'd like

Maybe Ufo can cache the result of getmatches(), and apply to the folded text

Additional context

Thanks Kevin for creating Ufo, It's very amazing!

kevinhwang91 commented 1 year ago

It's hard to compatible vim's :match system.

There're some limitations to capture highlighting in ufo:

  1. ufo only captures the highlight group with fg attribute, but from the image you provided, I'm afraid that it doesn't contain fg attribute;
  2. In mixed capturing mode, the priority is unconfirmed because Neovim has two priority systems for highlighting;

You can customize the fold_virt_text_handler to implement this feature, I know this workaround is not perfect. You must call getmatches to get the matches and inject the target match into the new virt text.