Vim plugin to interact with jupyter_ascending
Currently only supports Jupyter Notebook.
First, you must install jupyter_ascending in the python envirenment you're working in. For example:
$ pyenv activate my_notebook_env
$ pip install jupyter_ascending
It is possible you won't need to run the following commands on newer version of jupyter notebook, but it's recommended that you do anyway, because installing extensions is hard. Or unless you already executed them in the previous step of installing jupyter_ascending
.
$ jupyter nbextension install --py --sys-prefix jupyter_ascending
$ jupyter nbextension enable jupyter_ascending --sys-prefix --py
$ jupyter serverextension enable jupyter_ascending --sys-prefix --py
You can confirm it's installed by checking:
$ jupyter nbextension list
$ jupyter serverextension list
Then install this plugin using the vim plugin manager you like. For example:
Plug 'untitled-ai/jupyter_ascending.vim'
Or if you use lua configs:
use 'untitled-ai/jupyter_ascending.vim'
- First create a Jupyter notebook notebook_name.sync.ipynb.
- Then generate a notebook_name.sync.py file using jupytext with "percent format". (see Paired notebooks in jupytext)
- Edit .sync.py file in vim and Jupyter Ascending will update the .sync.ipynb every time .sync.py is saved.
- Send commands to Jupyter notebook via the following mappings:
Execute cell
nmap <space><space>x <Plug>JupyterExecute
Execute all cells
nmap <space><space>X <Plug>JupyterExecuteAll
NOTE: it syncs your py
file with ipynb
file whenever you save your py
file.
Use # %%
to separate cells.
Use # %% [markdown]
to make a markdown block.
See doc/jupyter_ascending.txt
for more information.