dccsillag / magma-nvim

Interact with Jupyter from NeoVim.
GNU General Public License v3.0
977 stars 49 forks source link

Add command to toggle automatic output #116

Open halvarsu opened 11 months ago

halvarsu commented 11 months ago

Does what it says, toggling the automatic output feature. I personally found this to be useful, as automatic output can be either nice or a nuisance depending on the situation/notebook. I'm not sure if there is some other way of achieving this through nvim; this seemed like the easiest solution to me.

benlubas commented 10 months ago

This is an interesting PR, b/c there are two approaches here. One of them is the PR that you've submitted, just add a single purpose "toggle" function to magma.

But what if others want to change their image provider or whether or not they copy output automatically, or any other feature controlled by a configuration variable?

Then it might be better to re-write the way the MagmaOptions class works. Instead of grabbing global values only on load, perhaps we could grab them each time they're needed, or provide a general command: MagmaRefreshOptions which can then be used by users in a keymap or function.

halvarsu commented 10 months ago

Agreed, good point! Your approach sounds much better. I had to learn the hard way that this wasn't the way it was working already...

Which then begs the question, why would someone not want global values to be grabbed continuously? Do you have a use case where MagmaRefreshOptions is a better solution in mind?

benlubas commented 10 months ago

I'd imagine b/c this is a remote plugin fetching the config values and storing them is a little more performant.

I'm not 100% sure on that, but it just feels like it would be the case

benlubas commented 10 months ago

My version of the plugin is not nearly ready yet (there are new breaking changes every day at this rate), but I have added a function that lets users set options after initialization, here's the entry in the readme