Closed nicolas-goudry closed 2 months ago
Thanks for the suggestion!
If the change is ok as is, I would be willing to open a PR with these changes.
Before you create a PR, I'd like to ask one question, since I don't know much about nvim_exec_autocmds
. Does sending events every keypress affect the performance of screenkey and/or neovim? (I guess not but I had to ask)
I’m not aware of any performance implication related to executing a fair amount of autocommands in a short time period. I couldn’t find anything online, nor in the documentation. All I can say is that it works well in my setup!
I’ll let someone more experienced answer this question…
If you fear bad perf, maybe this could be an opt-in option?
I just tested it and I'm not experiencing any issues. If you want you can open up a PR, and if someone reports performance-related problems I can make this feature opt-in (or you can do it right away in the PR, if you're interested).
I think ScreenkeyChanged
should only be fired if vim.g.screenkey_statusline_component
is true
so you can toggle your status line component with :Screenkey toggle_statusline_component
or with vim.g.screenkey_statusline_component = not vim.g.screenkey_statusline_component
. Can you check if that approach works with heirline since I don't use it?
One last thing: it would be awesome if you included an example of setting up heirline component in the README (you don't have to add it to doc/screenkey.nvim.txt
it will be autogenerated from the README).
Neat! I will open a PR shortly.
Problem
I have a fully custom statusline using heirline and would like to show screenkey in it. In order to do so, I need to be able to tell heirline when it should update the component which displays screenkey, which is currently not possible (afaict).
Expected behavior
I think using a user event would be the best way to handle this use case. The change should be quite small and would look something like this:
Then, in heirline the component would look like this:
I actually tested this implementation and it works as expected (with a few changes needed to the heirline component to make it look cleaner). If the change is ok as is, I would be willing to open a PR with these changes.