quickpeek.vim icon indicating copy to clipboard operation
quickpeek.vim copied to clipboard

Support neovim

Open wookayin opened this issue 5 years ago • 3 comments

Great work, thanks! It seems that you are using VIM 8 APIs (e.g. popup_create) but it would be great to support neovim as well, since many other floating window based plugins operate both on vim and neovim.

wookayin avatar Jan 23 '20 19:01 wookayin

I'd like to be neovim-compatible, but I have to learn how to do it first. I'll try to read up on the docs, see what I can come up with.

AndrewRadev avatar Jan 24 '20 14:01 AndrewRadev

Really looking forward to this. Thank you @AndrewRadev

SanchayanMaity avatar Apr 08 '20 04:04 SanchayanMaity

This is significantly more complicated than I expected it to be. I created a branch named neovim-support that sort of works, but with a lot of issues:

  • No border -- Neovim doesn't support that yet, but that seems like not much of a problem
  • The first time the popup is opened, it always throws an error, failing to enter it. I can't understand why, other than some weird combination of the quickfix window and popups. What I'm doing is catching the error and ignoring it -- moving the cursor shows the popup successfully.
  • There's an annoying redraw flicker when moving the cursor that is not there with Vim. I can't think of a way to solve it. I imagine Neovim's floating windows are "heavier" than Vim's popups, since they're more featureful? I considered reusing the same window and changing its buffer (instead of deleting and recreating), but I couldn't find any API to do that. Maybe there's the option to enter it and :bufnr the target buffer, but this issue is still not the worst one. (Update: this might be related to using urxvt, a minimal terminal -- on gnome-terminal, there's a lot less flicker, though there still is a bit.)
  • Occasionally, some preview will not get syntax highlighting. This is not Neovim-specific, exactly, because I had this happening in Vim as well. However, in Vim, I worked around the issue by running the "show popup" function with a timer: call timer_start(1, {-> s:ShowPopup()}). This doesn't seem to work in Neovim at all. Moreover, with Vim, even if the buffers weren't syntax highlighted, pressing <enter> would open them normally. In Neovim, pressing <enter> on a line with a non-syntax-highlighted preview would open the buffer in the quickfix window instead.

The quickfix window seems to load buffers in a very odd way in both Vim and Neovim, and it seems like this is causing some really strange issues. With Vim, I could find workarounds, but I can't figure anything out for Neovim. If you'd like, try the branch out, but to me, it seems practically unusable :/. I might try opening issues to Neovim, but I need to figure out how to describe the issue and reproduce them with some test code.

AndrewRadev avatar Apr 08 '20 18:04 AndrewRadev