vim-iced icon indicating copy to clipboard operation
vim-iced copied to clipboard

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

Open formsandlines opened this issue 3 years ago • 3 comments

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).

formsandlines avatar Feb 15 '22 14:02 formsandlines

@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 avatar Feb 15 '22 21:02 liquidz

@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.

liquidz avatar Feb 16 '22 21:02 liquidz

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

  • lukas-reineke/indent-blankline.nvim
  • michaeljsmith/vim-indent-object and have also set "let g:iced_enable_auto_indent = v:false", but the problem still remains.

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

Is there something else I could try?

formsandlines avatar Feb 18 '22 18:02 formsandlines