Skip to content

jannis-baum/jupyviv.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 

Repository files navigation

jupyviv.nvim

This plugin connects Neovim to Jupyviv, allowing you to work with and run Jupyter Notebooks from the comfort of your favorite text editor. Refer to the main Jupyviv repository for general information.

Showcase

Setup

  • locally
    • install Vivify and Jupyviv
    • install this plugin whichever way you prefer to install Neovim plugins, then run the following to load it:
      require('jupyviv').setup()
  • wherever you want to run computation (locally or on a different machine)
    • install Jupyviv
    • install the Jupyter Kernel for the language you need, e.g. pip install ipykernel for Python

Usage

Jupyviv exposes various commands to control it. All commands are bound to Lua functions that can also be used, e.g. to set up key bindings. See lua/jupyviv/init.lua for more information.

Starting Jupyviv

To start Jupyviv for an existing Notebook, run :JupyvivStart in a .ipynb Notebook buffer. This will

  • Open Vivify to render the Notebook
  • Create two new files, a .jupyviv.ipynb and a .jupyviv.[x] file (where [x] depends on the language, e.g. py for Python). It's recommended to globally git-ignore both files, and you can personally fully ignore the .jupyviv.ipynb file.
  • Make Neovim automatically switch to a new buffer with the .jupyviv.[x] file. This file is a plain text version of the code in the Notebook and all Jupyviv functionality is bound to its buffer:
    • Saving the buffer will sync the code with the Notebook and refresh Vivify
    • Closing the buffer (e.g. :bd) will shut down Jupyviv

Running :JupyvivStart without any arguments manages the Jupyviv Agent automatically. If you want to use a running agent instead, use :JupyvivStart agent=<address> to provide its address.

To create a new Notebook, you can run :JupyvivNew <path/to/file.ipynb>. Here you have to either specify kernel=<name> to let Jupyviv know which kernel to use for the automatically managed Agent, or agent=<address> to use a running Agent.

Jupyviv buffer

In the Jupyviv buffer, you can run the following commands:

  • :JupyvivRunHere to run the code cell the cursor is currently in
  • :JupyvivRunSelection to run the code cell the cursor is currently in, or all cells within the selected area in visual mode
  • :JupyvivRunAll to run all code cells
  • :JupyvivInterruptKernel to keyboard interrupt the kernel (equivalent of pressing <ctrl>-c on the Kernel's stdin)
  • :JupyvivRestartKernel to stop immediately and restart the kernel
  • :JupyvivKill to shut down Jupyviv
  • :JupyvivClearExecution to remove all outputs and execution counts
  • :JupyvivEnumerateExecution to enumerate all execution counts without modifying outputs

About

Edit and run Jupyter Notebooks from Neovim while live viewing them with Vivify

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages