# Vim plugin for Jupyter notebooks?

**URL:** https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500
**Category:** General Usage
**Tags:** question, proposal
**Created:** [November 25, 2019, 3:45pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500 "2019-11-25T15:45:13Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)
#### Post date: [November 25, 2019, 3:45pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/1 "2019-11-25T15:45:13Z")

</div>

Is it possible to make a VIM plugin to view and edit Jupyter notebooks?

When somebody sends me a Jupyter notebook, I always dread opening up my browser to view it. A much simpler solution would be to just open it from VIM without launching a browser. Instead of displaying the graphics inside the VIM editors, a separate window could be opened to display the results of a graphics calculation, just like in the REPL. Text results would be displayed in VIM.

This is something I don’t have the knowledge, skills, or time for, but maybe someone else might.

---

<div class="post-metadata">

### Author: ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)
#### Post date: [November 25, 2019, 9:08pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/2 "2019-11-25T21:08:33Z")

</div>

If you’re willing to give emacs with evil for vi-emulation a chance, [emacs-ipython-notebook](http://millejoh.github.io/emacs-ipython-notebook/) is an alternative frontend to jupyter notebooks (originally by the Julia community’s own tkf). I haven’t used it in a year or so, and when I did the support for languages other than python was buggy at best, but it looks like significant development has gone into making it more general since then.

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [November 25, 2019, 9:21pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/3 "2019-11-25T21:21:23Z")

</div>

middle ground: use vim in jupyter [https://github.com/lambdalisue/jupyter-vim-binding](https://github.com/lambdalisue/jupyter-vim-binding)

---

<div class="post-metadata">

### Author: ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)
#### Post date: [November 25, 2019, 9:43pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/4 "2019-11-25T21:43:44Z")

</div>

The following does (something like) what you describe using `jupytext`, which allows 2-way conversion between ipynb and other formats:

[https://github.com/goerz/jupytext.vim](https://github.com/goerz/jupytext.vim)

---

<div class="post-metadata">

### Author: ![fnin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fnin/32/23300_2.png) [@fnin](https://discourse.julialang.org/u/fnin)
#### Post date: [November 25, 2019, 9:47pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/5 "2019-11-25T21:47:43Z")

</div>

One possibility is to use [https://github.com/wmvanvliet/jupyter-vim](https://github.com/wmvanvliet/jupyter-vim).  
You would have to convert the notebooks with

```bash
jupyter-nbconvert -to script Notebook.ipynb

```

Then you can open a jupyter-qtconsole with

```bash
jupyter-qtconsole --kernel=julia-1.2

```

open the converted Notebook and connect to the qt console in vim with

```julia
:JupyterConnect

```

You can then run a cell, delimited by lines starting with `##`, with `<localleader> X`.  
Unfortunately converting the notebook with --to script doesn’t conserver the cell delimiters like the --to python option does for python.

The jupyter-vim plugin does not provide a lot of keybindings for the jupyter-workflow (run and jump to next cell, delete cell, jump to next/previous cell) but these should be not to difficult to come up with.

Edit:  
After reading ihnortons answer I found converting the notebook with jupytext:

```bash
jupytext --to .jl:percent notebook.ipynb

```

Will leave the cell structure intact, so it can easily be used with jupyer-vim.

---

<div class="post-metadata">

### Author: ![zgornel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zgornel/32/217487_2.png) [@zgornel](https://discourse.julialang.org/u/zgornel)
#### Post date: [November 26, 2019, 8:03am UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/6 "2019-11-26T08:03:36Z")

</div>

More of a trojan horse! 😁

---

<div class="post-metadata">

### Author: ![NightMachinary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nightmachinary/32/14196_2.png) [@NightMachinary](https://discourse.julialang.org/u/NightMachinary)
#### Post date: [March 23, 2021, 6:20pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/7 "2021-03-23T18:20:36Z")

</div>

Using VSCode with the Vim extension works if the latest insiders build of both VSCode and the Python extension are used. It works very well.

EIN (Emacs) is buggy for me; E.g., the last line of a cell can often not be deleted with `dd`.

---

<div class="post-metadata">

### Author: ![schneiderfelipe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schneiderfelipe/32/18004_2.png) [@schneiderfelipe](https://discourse.julialang.org/u/schneiderfelipe)
#### Post date: [February 15, 2022, 2:41pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/8 "2022-02-15T14:41:23Z")

</div>

Might not be what people are looking for, but [codi.vim](https://github.com/metakirby5/codi.vim) is a nice alternative.

---

<div class="post-metadata">

### Author: ![Kiyoon\_Kim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kiyoon_kim/32/46375_2.png) [@Kiyoon\_Kim](https://discourse.julialang.org/u/Kiyoon_Kim)
#### Post date: [January 30, 2023, 3:57pm UTC](https://discourse.julialang.org/t/vim-plugin-for-jupyter-notebooks/31500/9 "2023-01-30T15:57:59Z")

</div>

There is a new plugin for Neovim that people may be interested. It uses Selenium browser automation to fully synchronise vim to Jupyter Notebook. It will automatically open a Jupyter Notebook server and Firefox so you can view and edit ipynb directly from vim.

[https://github.com/kiyoon/jupynium.nvim](https://github.com/kiyoon/jupynium.nvim)
