dccsillag / magma-nvim

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

Request - Persistent output below cell #18

Open Lun4m opened 2 years ago

Lun4m commented 2 years ago

Would it be possible to have a persistent output "window" below the executed cell that doesn't cover the code? Something like in this other plugin that reads .ipynb files.

dccsillag commented 2 years ago

The thing is that it's currently impossible to add content between lines of a buffer without changing its text.

Simply changing the buffers' text is problematic; to name a few issues:

But there is work in progress for this:

We could also try to add some hacky solutions for this (e.g., maybe something with diff mode?), but I'm not very confident.

Lun4m commented 2 years ago

Yeah, I assumed it was impossible, but I still wanted to ask because having the persistent output window would almost completely replicate the Jupyter notebook experience. The two pull requests you linked sound promising though, so hopefully it's something that can be implemented in the future!

yingzhu146 commented 2 years ago

This isn't a perfect solution by any means but either a good alternative which will potentially provide parts of a solution or a separate request.

What you could do is allow connecting to the same jupyter kernel with a different frontend, which would end up being something like jupyter console a la https://github.com/jpalardy/vim-slime, which would allow using stuff like https://github.com/jktr/matplotlib-backend-kitty or something like https://github.com/joouha/euporie.

Users can then toggle that pane (which is my current notebook set up pretty much, a Lua copy of vim-slime I wrote and then matplotlib kitty in a separate kitty pane controlled by the kitty remote control)