justinmk / vim-sneak

The missing motion for Vim :athletic_shoe:
http://www.vim.org/scripts/script.php?script_id=4809
MIT License
3.26k stars 88 forks source link

cchars displayed with label highlighting #271

Closed BertrandSim closed 1 year ago

BertrandSim commented 3 years ago

Hello!

I notice that when sneak-label-mode is enabled, concealed cchars are shown with label highlighting.

Here is an example with .tex

image

" vimrc

call plug#begin('~/.vim/plugged')
  Plug 'lervag/vimtex'
  Plug 'justinmk/vim-sneak'
call plug#end()

let g:sneak#label = 1
% tex

$\alpha$ $\beta$
word word word

On the last line, pressing swo highlights α and β, even with set conceallevel=0.


I noticed that there are similar issues. However, those are specific to the Indent Line plugin. In general, this seems to occur with any buffer that uses cchars. I also noticed that #244 attempted to fix this issue, but the bug still persists.

I had a glance at the code for #244, and my hunch is that getmatches() only picks up groups defined by matchadd() and :match, and does not pick up groups defined by

syntax match {name} {regex} contained conceal cchar={char}
justinmk commented 3 years ago

There's no good way to fix this without causing other problems, AFAIK. #252 is a particular case of a general Vim limitation.

justinmk commented 1 year ago

https://github.com/justinmk/vim-sneak/pull/303 fixes this for Nvim.