liquidz / vim-iced

Clojure Interactive Development Environment for Vim8/Neovim
https://liquidz.github.io/vim-iced/
MIT License
518 stars 35 forks source link

After connect, vim.highlight.on_yank seems to be triggered automatically (Neovim) #384

Open formsandlines opened 2 years ago

formsandlines commented 2 years ago

After connecting to an nREPL, as soon as I type any character that is not either one of (){}[]'\ (probably some others too), the top-level form (with all its nested forms) gets highlighted as if a yank has occurred.

I have tried to disable all the other plugins that might cause a conflict (even coc, treesitter and my theme), but this seems to be an issue with vim-iced. It also doesn't matter what I set my clipboard to. The highlighting only disappears after I delete my TextYankPost autocommand, which looks like this:

augroup highlight_yank
    autocmd!
    au TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=200}
augroup END

Here is a quick demonstration (wait for the part after :IcedConnect):

220215_vim-iced-highlight-bug

A temporary fix I found is to add on_visual=false to the highlight.on_yank options. It seems that the issue has something to do with visual selection, although it occurs in normal mode.

This is not ideal, since I still want to highlight yanked text in visual mode, but it is a compromise I can live with for now (considering the amazing IDE-ish experience vim-iced has to offer).

liquidz commented 2 years ago

@formsandlines Thanks for your reporting!

Hmm, weird.. g:iced_enable_auto_document can yank the current form on every input (We do have some delays), but it is only up to the current form, not the top-level form. https://liquidz.github.io/vim-iced/vim-iced.html#g%3Aiced_enable_auto_document

Otherwise, there should be no process that yanks on every input.

I'll have a look some more.

liquidz commented 2 years ago

@formsandlines I've tested with minimal configuration + vim.highlight.on_yank. https://liquidz.github.io/vim-iced/#minimal_configuration

Auto indenting may be the cause. https://liquidz.github.io/vim-iced/#auto_indenting

With the minimal configuration, top level form will be highlighted when <CR> entered. So I think there is another plugin that is trying to indent every time you type.

formsandlines commented 2 years ago

Yeah, this makes sense. I tried to disable all my plugins that involve indentation:

I'll also try the minimal configuration when I have some time, maybe I missed something.

Is there something else I could try?