hop.nvim
hop.nvim copied to clipboard
[Bug] Error when trying hop with a floating window open
Hi 👋🏿 ,
Firstly, thanks for your work phaazon, it's much appreciated 💯.
On to the issue, since moving over to hop v2. I've been getting errors when trying to trigger HopChar1MW i.e. a hop job with multiwindow set to true. I've narrowed down this issue to an interaction with nvim-treesitter-context but I think it's probably applicable to any other floating windows, e.g. I believe I've seen this also whilst using nvim-lightbulb.
The error is:
E5108: Error executing lua ...re/nvim/site/pack/packer/opt/hop.nvim/lua/hop/window.lua
:7: Failed to switch to window 1004
stack traceback:
[C]: in function 'nvim_set_current_win'
...re/nvim/site/pack/packer/opt/hop.nvim/lua/hop/window.lua:7: in function 'wi
ndow_context'
...re/nvim/site/pack/packer/opt/hop.nvim/lua/hop/window.lua:84: in function 'g
et_window_context'
...hare/nvim/site/pack/packer/opt/hop.nvim/lua/hop/init.lua:50: in function 'c
reate_hint_state'
...hare/nvim/site/pack/packer/opt/hop.nvim/lua/hop/init.lua:303: in function '
hint_with_callback'
...hare/nvim/site/pack/packer/opt/hop.nvim/lua/hop/init.lua:287: in function '
hint_with'
...hare/nvim/site/pack/packer/opt/hop.nvim/lua/hop/init.lua:474: in function '
hint_char1'
[string ":lua"]:1: in main chunk
A minimal init.lua is
vim.cmd("packadd hop.nvim")
vim.cmd("packadd nvim-treesitter-context")
require("hop").setup()
require("treesitter-context").setup()
Then start nvim with v -u ~/minimal.lua --noplugin <path to a large file>
With context enabled, scroll down until the context window appears. With the window in view, press :HopChar1MW and press a character. This will trigger the error.
That’s an interesting use-case. I’m trying to reproduce and will see how to fix the bug.
Okay it was easy to reproduce, thanks a lot! I will prioritize that one, it’s pretty bad.
That first commit fixes a situation that is not exactly the one you described. Can you switch your Hop setup to use branch = fix-multi-window-floats, update, and tell me whether you still reproduce? I’m continuing looking for your situation but I don’t exactly reproduce it.
Hi, thanks for picking this up. I just tried the latest branch, and it still happens, unfortunately. Scrolled down till there was a context window
Which version of nvim @akinsho are you using? nvim --version should be enough.
NVIM v0.8.0-dev-2203-gc1652bdcb
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/opt/homebrew/Cellar/neovim/HEAD-c1652bd_1/share/nvim"
Run :checkhealth for more info
Thanks!