Closed blarz closed 1 week ago
I have the same bug, just noticed it last week before updating to 10.2. 100% cpu core usage when recording macro, but using a clean install of nvim it goes down to 5%
Had a look around in the code today and in the commit https://github.com/folke/which-key.nvim/commit/6b023b4c29ecc0aad06a51dd14bd2754b43bb0c8, fixing an issue with macros and which-key, it looks like an "infinite recursion", or busy waiting loop calling M.schedule()
(wrapped in a timer though), until macro recording is finished:
https://github.com/folke/which-key.nvim/blob/6b023b4c29ecc0aad06a51dd14bd2754b43bb0c8/lua/which-key/triggers.lua#L139-L149
Maybe I understand the code wrong and I am not sure if that was intended, or if there is a better way, but it would explain the CPU usage.
According to https://github.com/LazyVim/LazyVim/issues/4553 folke is on vacation until the end of the month :palm_tree:
Obligatory XKCD :sweat_smile:
But seriously, is this M.schedule()
loop actually needed? I tried the plugin without that line, or rather just a return
and I could record macros without high CPU usage and the issue with the double recorded characters also didn't happen.
But then again I don't know the codebase at all, so I am not sure what purpose that line serves.
Awesome, thank you! :rocket:
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10.2
Operating system/version
Ubuntu 22.04.
Describe the bug
By accident I left a neovim instance open where there was a macro recording session still running (classic
qq
I guess). I noticed the CPU fan was spinning and then checked top confirming thatnvim --embed
was running at 100% CPU. Hittingq
to stop the recording got the CPU usage back to normal.Bisecting my neovim config I found out that this issue only occurs with the which-key plugin loaded.
Seeing that there was some work done in that are, e.g. #851, maybe there are some issues left there?
Steps To Reproduce
nvim foo.txt
qq
q
Expected Behavior
Regular CPU usage
Health
No response
Log
No response
Repro
No response