Closed primeapple closed 7 months ago
I use an autosave plugin, which triggers a save command after 2 seconds of inactivity. Also I have a
dirty
indicator in my statusbar, which shows if the current file is dirty.The issue is that the indicator does not recognize the autosave event and only updates itself after e.g. moving the cursor.
If you want to manually trigger a statusline, the API is already there, see :h tpipeline#update()
.
For when you need to call this from Lua, see :h vim.fn
for reference.
Another plugin I use is this plugin https://github.com/karb94/neoscroll.nvim. It adds a smooth scrolling ability. This leads to many updates to the statusline (line position changes). It can't update fast enough, leading to some kind of queue filling up. So let's say I press and consecutively a lot. After the scrolling finished the statusbar will continue updating for some seconds afterwards.
Interesting, even if I do some ridiculous stuff like :call timer_start(1, {-> feedkeys('j')}, {'repeat': 200})
(which will effectively cause a statusline update every millisecond), the statusline in tmux does not lag behind by very much.
But it definitely becomes noticable, when using the kitty integration, so the problem is not really that this plugin is too slow, but rather that kitty can't keep up.
I should be able to fix this fairly easily however, by batching updates if the downstream consumer is taking too long...
But it definitely becomes noticable, when using the kitty integration, so the problem is not really that this plugin is too slow, but rather that kitty can't keep up.
Yeah, I guess it's from kitty, since looks like it the redraw function of the tabbar is called multiple times for each update from tpipeline.
I have now implemented batched updates, the problem with the statusline lagging behind should be completely fixed now, no matter how slow the downstream consumer is.
Everything works, thanks so much! :partying_face:
I use an autosave plugin, which triggers a save command after 2 seconds of inactivity. Also I have a
dirty
indicator in my statusbar, which shows if the current file is dirty.The issue is that the indicator does not recognize the autosave event and only updates itself after e.g. moving the cursor.
Another plugin I use is this plugin https://github.com/karb94/neoscroll.nvim. It adds a smooth scrolling ability. This leads to many updates to the statusline (line position changes). It can't update fast enough, leading to some kind of queue filling up. So let's say I press and consecutively a lot. After the scrolling finished the statusbar will continue updating for some seconds afterwards.
These may problems may be solved by manually triggering the statusline update function only after certain events on on certain callback hooks. How would I do that (preferably in lua)