• Stars
    star
    166
  • Rank 227,748 (Top 5 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created over 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vim plugin to interact with jupyter_ascending

jupyter_ascending.vim

Vim plugin to interact with jupyter_ascending Currently only supports Jupyter Notebook.

Jupyter Ascending

Installation

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'

Usage

  1. First create a Jupyter notebook notebook_name.sync.ipynb.
  2. Then generate a notebook_name.sync.py file using jupytext with "percent format". (see Paired notebooks in jupytext)
  3. Edit .sync.py file in vim and Jupyter Ascending will update the .sync.ipynb every time .sync.py is saved.
  4. 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

Restart kernel

nmap <space><space>r <Plug>JupyterRestart

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.

Settings

See doc/jupyter_ascending.txt for more information.