Vim-compatible notebook workflow?

Does anyone have any good suggestions for interacting with Jupyter notebooks using Vim / Vim keybindings?

What I would really like is to be able to edit and interact with notebooks within Vim itself, as RMarkdown format, or similar, with the ability to execute individual cells, all cells, all cells above / below, and with kernel restarts.

I was nearly, nearly there with Atom and Hydrogen and RMarkdown support and Vim keybindings, but that setup doesn’t have the ability to re-run all cells, cells above / below, and it looks like it may be a dead-end, as Atom subsides. I’ve tried VSCode current insider notebook support, and it’s similar to what I need, but still terribly buggy. And I’d rather use community-based tools if I can.

I know of the Jupyter / JupyterLab vim keybindings options, but I would like to avoid the three mode problem if at all possible (Jupyter mode, Vim command mode , and Insert mode).

Does anyone have any suggestions or pointers?

2 Likes

Hello @matthew.brett I unfortunately have no answer but I am looking at exactly the same thing. Ideally I would like to write my R file and be able to “send” code chunk execution commands to the notebook to be executed.

I’ve looked around jupytext a bit to be able to sync R/Rmd and the notebook and that’s the best I have for now. I can write in R/Rmd within vim and changes are automatcally reflected in jupyter, but I cannot update a chunk form vim.

Note that I have looked also at runing vim within R studio in a terminal and editing the Rmd in vim while executing the chunks in Rstudio, but for now when I change the Rmd file externally, Rstudio reloads it and invalidates the output chunks (sigh)

Ironically, I find RStudio much easier to use in this respect. The Vim keybindings aren’t perfect, but they are a lot better than nothing, and it helps a lot that the native format of the R notebook is text.

Jupytext gets us much closer that goal, and I use it all the time.

I just came across What features would you like to see? · Issue #17 · szymonmaszke/vimpyter · GitHub did you try it already?