Open nyngwang opened 1 year ago
It's an easy change, but to be honest I don't see much value in it. Why would you like to exit the animation with different keys?
FYI after last commit you can safely exit animation with :q or ZZ.
I think my title is bad. Let me rephrase it. How about making "any key" the key to exit the animation? That is: use a one-time CursorMoved event to quit the animation. So I'm not saying that the current implementation is bad (For the current one, I was thinking about typing a password to cancel the animation), but I think it will be useful and fun to have a "press any key to exit" toggle to this plugin. (With this CursorMoved method, it will work more like a screen saver.)
Yea, any-key makes sense and I actually wanted to do that in the first place, but I didn't know how. Subscribing to cursorMoved event seems like a good idea. I'll add it later.
@Eandrju Thank you! You might checkout this project: https://github.com/itchyny/screensaver.vim, which seems to implement the any-key-cancellation for its animation. But since I haven't read about its code, it might not be useful.
I would also love to have direct call to start and end animation, so that it lets us to customize extensively.
For example, I can have a keymap with custom function that lets me prepare animation (disable cursor column, indent line and what not) before starting animation.
I can have also have a function to start animation and stop or even exit vim after sometime.
Having blocking call at the end of start animation function is something I do not vote for.
As title. That is: one can customize the key(s) (not
Esc
,q
,<CR>
) to quit the animation.