Cursor keep moving after pressing a key for a while and release
xarthurx opened this issue · comments
I think this is a delayed responsive issue.
When I press j
or k
for a while to move up / down continuously, the cursor will go as I keep the key pressed.
However, when I release the key, in other front-end like neovim-qt
, the cursor will stop moving immediately.
But in Nvy
, the cursor will keep moving for a while.
(the effect is very obvious on my machine after moving the cursor for around 30-50 lines).
OS: Windows 11
It's really bad with such lag. Sometimes I check editor responsiveness by going to Visual Block
mode and holding %
on a brace of some decent sized function, too big will always appear slow, too small will always be fast.
In my opinion neovim-qt
is also okay with performance but I'd say a bit worse than Nvy
. What I've noticed is, despite looking sluggish, neovim-qt
will stop almost immediately as you release the button - probably it won't queue excessive keyboard events.
Anyway holding j
or k
should never much lag.
Fix what really slows you down
Is the lag also noticeable when ran with no config - Nvy.exe -u NORC
? I doubt it and its most likely some nasty plugins causing the lag. Or are some autocommands causing it?
I strongly suggest you try to disable parts of your config, especially plugin activation, until you find the culprit.
Try commenting half of the plugins and checking again, continue until you find the problem. I have eliminated many slow plugins this way, some don't even look like they take lots of processing power to operate. I'm sure u can find performant alternative for your bottleneck, lua
is often much faster.
Actually I'm on Nvy
because it almost never crashes and has pretty good performance. I'm on Windows 10
though.
Alternatives
For best performance you probably want to get Alacritty
- a terminal emulator. It has the smoothest feel but it also seems to queue up the keyboard events, so you might not be happy there. Though raw speed of Alacritty
should compensate and you should rarely find yourself watching your action continue as you stop holding a button. Seems like Nvy
is also no match for Alacritty
when it comes to performance.
Maybe you have your repeat rate
of keyboard set as too high (set in control panel), reducing that speed will make your text editor less likely to be overwhelmed by the keyboard events. I have it at max speed though and nothing will make me reduce it :) Changing it will most likely require some time to get used to.
There is also a small chance your font might be wrongly configured, is it rendering correctly?
You might consider using different way of moving through the file than holding j
or k
, there are so many more ways. To name a few:
<c-d>
and<c-u>
- I'm not a fan of its mapping but its useful for quick scrolling{
and}
- to jump between empty lines, works pretty good unless your text has too few of themzj
andzk
- to navigate between folds, default binding is cumbersome but u can change itlightspeed
orvim-sneak
- when you see what you're looking for/
- when you know what you're looking for
j
and k
should be ideally used for minor adjustments.
Conclusion
I guess issue is still valid as doing some heavy task by holding a button can keep it going for several seconds after release, while nvim-qt
found a way to prevent it.
EDIT: Are you using Nvy
in fullscreen by any chance? I noticed its very slow in fullscreen.
have the same problem
the follow setting will increase the latency
set curosrline
set foldenable
set foldlevel=1
set foldmethod=indent
have the same problem the follow setting will increase the latency
@chenjie199234 So do you mean it also happens with nvim -u NORC
or just these 4 lines as config?
It seems keep a key pressed for long is a rare case and that was why it did not bother me much before. Anyway, I had experienced the delay earlier and I did a little test on my setup. The result:
- If I remove
init.vim
and start nVim, scrolling is fast and stops immediately - Maybe folding slows down scrolling but in my case folding is always disabled(as well as
cursolline
) - I have enabled
cursorcolumn
in my config, but switching it off changes nothing - After disabling/enabling various features in my config, I found out one of the heaviest "anchor" of my setup:
set number relativenumber
. When I commented this line out, the scrolling becomes more responsive. Maybe some plugins slow down scrolling, too but I have not investigated this - at this moment I am fine with the current speed as I seldom scroll up and down very far with arrows.
@VladimirMarkelov Thank you for your input!
I suspected its more of a problem of plugins and configuration than Nvy
performance itself. Though it still behaves badly when it's slow (lag).
I hope you will get into making your nvim
more snappy in a free time! It might be good enough but its much more pleasant when its fast, as the lag will most likely affect you in most of your actions anyway.
@EtiamNullam
in my situation:
1.remove all the init.lua or init.vim
2.open nvy with a golang file(about 1000 line)
3.set the following settings by command line
set curosrline
set foldenable
set foldlevel=1
set foldmethod=indent
4.the latency happened
it is always ok,both with configfile or without,when i use the neovim's nature nvim-qt.exe
but the nvy has problems
1.remove all the init.lua or init.vim
Try starting Nvy with Nvy.exe -u NORC
instead, to make sure it's not loading anything by accident.
2.open nvy with a golang file(about 1000 line)
3.set the following settings by command line set curosrline set foldenable set foldlevel=1 set foldmethod=indent
I always have these options (and many more) yet I never experience lag while simply scrolling in Nvy
. So it has to be something else. So there is still some lag with these options disabled?