Eandrju / cellular-automaton.nvim

A useless plugin that might help you cope with stubbornly broken tests or overall lack of sense in life. It lets you execute aesthetically pleasing, cellular automaton animations based on the content of neovim buffer.
MIT License
1.89k stars 34 forks source link

Could you provide a config option for customizing how to quit the animation? #4

Open nyngwang opened 1 year ago

nyngwang commented 1 year ago

As title. That is: one can customize the key(s) (not Esc, q, <CR>) to quit the animation.

Eandrju commented 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.

nyngwang commented 1 year ago

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.)

Eandrju commented 1 year ago

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.

nyngwang commented 1 year ago

@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.

ragu-manjegowda commented 1 year ago

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.