kamykn / spelunker.vim

Improved vim spelling plugin (with camel case support)!
MIT License
359 stars 21 forks source link

Support Neovim floating window #31

Closed Zarathustra2 closed 4 years ago

Zarathustra2 commented 4 years ago

It would be cool if Zl would also spawn a floating window/popup window when using neovim instead of vim.

kamykn commented 4 years ago

Hi, @Zarathustra2 !

I had referred to Neovim document about floating window because I'm not Neovim user. I found it floating window is just a buffer, furthermore it is not selection menu.

Now, ZL Command behavior is depends on popup_menu() function. If I find a good way, I would like to implement it, but the best thing is that Neovim implements popup_menu().

Zarathustra2 commented 4 years ago

I see. Hopefully they will implement the api because I really like your plugin!

kamykn commented 4 years ago

Hi, @Zarathustra2 !

I have implemented an plugin that supports operations like Vim8 popup-menu() even when using Neovim.

This plugin is available in spelunker.vim. If you want try it, please update the plugin and add a plugin kamykn/popup-menu.nvim.

Zarathustra2 commented 4 years ago

Thanks for your efforts!

My friend can confirm that it works.

But I am getting the following error when executing ZL:

Error detected while processing function spelunker#correct_from_list[7]..spelunker#correct#correct_from_list[27]..popup_menu#open[30]..<SNR>133_get_bin_path:                                                     
line   14:
Binary not found.
nvim -v Output
$ nvim -v
NVIM v0.5.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/builddir/build/BUILD/neovim-0.4.3.0.git.13628.49cd750d6/build/config -I/builddir/build/BUILD/neovim-0.4.3.0.git.13628.49cd750d6/src -I/usr/include -I/usr/include/lua-5.1 -I/builddir/build/BUILD/neovim-0.4.3.0.git.13628.49cd750d6/build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.4.3.0.git.13628.49cd750d6/build/include
Compiled by mockbuild

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Zarathustra2 commented 4 years ago

cc: @xiamaz

xiamaz commented 4 years ago

When I try it in a new buffer, the popup window will work the first time correctly after calling ZL, but stops working when calling ZL again.

The following error is displayed on subsequent calls:

Error detected while processing function spelunker#correct_all_from_list[7]..spelunker#cor
rect#correct_from_list[27]..popup_menu#open:
line   35:
E95: Buffer with this name already exists
kamykn commented 4 years ago

Thank you for your bug report!

@Zarathustra2 popup-menu.vim plugin are written by golang. I added support for some archtecture. https://github.com/kamykn/popup-menu.nvim/pull/1

@xiamaz I changed the buffer name and added error handling in popup-menu.vim. https://github.com/kamykn/popup-menu.nvim/commit/c189b90665d9813906dc783f5faa64e36458aee3

Please update popup-menu.vim plugin and try again! If the errors occur again, please let me know the steps to reproduce.

Zarathustra2 commented 4 years ago

@kamykn Thank u for helping!

My issue has now being fixed, but now I am getting the same issue as @xiamaz when executing ZL again

error occurred:Vim(file):E95: Buffer with this name already exists

kamykn commented 4 years ago

@Zarathustra2 @xiamaz

error occurred:Vim(file):E95: Buffer with this name already exists

Maybe this bug is fixed by this pull request. https://github.com/kamykn/popup-menu.nvim/pull/2

Please update popup-menu.vim plugin again.

Zarathustra2 commented 4 years ago

Can confirm that it now works! Thx @kamykn