Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Installation

Jan Weidner edited this page Jan 4, 2018 · 8 revisions

With IPython-notebook-extensions (Recommended)

IPython-notebook-extensions contains a collection of extensions that add functionality to the Jupyter notebook. These extensions are mostly written in javascript and will be loaded locally in your browser.

The project simplifies the task of maintaining multiple extensions as, all extensions that are maintained and active have a markdown README file for documentation and a YAML file to allow them being configured using the nbextensions server extension.

Install IPython-notebook-extensions

Follow the instructions at https://github.com/ipython-contrib/IPython-notebook-extensions#installation. In a nutshell, clone the repository and run python setup.py install to install as a local user.

Activate the extensions configurator

jupyter nbextensions_configurator enable --user

Add vim_binding to IPython-notebook-extensions

Once you have installed IPython-notebook-extensions, run the following from a shell (e.g. bash):

# You may need the following to create the directoy
mkdir -p $(jupyter --data-dir)/nbextensions
# Now clone the repository
cd $(jupyter --data-dir)/nbextensions
git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding
chmod -R go-w vim_binding

Activate the extension

Launch a Jupyter notebook session. Then, in a browser, go to <root>/nbextensions/; for example, if the notebook is hosted under localhost:8888, go to http://localhost:8888/nbextensions/. Activate VIM binding from the list of extensions. Check documentation for more details.

Without using IPython-notebook-extensions

If you don't use IPython-notebook-extensions, the second choice is using git clone or download the repository to directly install. First of all, clone or download the repository into Jupyter's data directory by running the following from a shell (e.g. bash):

Clone or download the extension

By using git clone (recommended)

# You may need the following to create the directory
mkdir -p $(jupyter --data-dir)/nbextensions
# Now clone the repository
cd $(jupyter --data-dir)/nbextensions
git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding

By using jupyter command

# You may need the following to create the directoy
mkdir -p $(jupyter --data-dir)/nbextensions/vim_binding
# Not download a plugin file
jupyter nbextension install https://raw.githubusercontent.com/lambdalisue/jupyter-vim-binding/master/vim_binding.js --nbextensions=$(jupyter --data-dir)/nbextensions/vim_binding

On Linux, either command should create a new file under ~/.local/share/jupyter/nbextensions/vim_binding On Mac OS X, this path should be ~/Library/Jupyter/nbextensions/vim_binding

Activate the extension

To activate the extension permanently, execute the following from a shell (e.g. bash):

jupyter nbextension enable vim_binding/vim_binding

In the event of an error, an alternative method of permanently activating the extension is to edit the /nbconfig/notebook.json file to include the following:

{                                
  "load_extensions": {          
    "vim_binding/vim_binding": true
  }                                
}  

To check where notebook.json is located, run the following in python:

from jupyter_core.paths import jupyter_config_dir
import os.path
fname = os.path.join(jupyter_config_dir(), 'nbconfig/notebook.json')
print fname

Activate from a notebook (optional)

Run the following in a code cell:

%%javascript
Jupyter.notebook.config.update({
  'load_extensions': { 'vim_binding/vim_binding': true },
});

Activate temporarily in the current session

Once after you have installed jupyter-vim-binding, restart your Jupyter server and then, run the following in a code cell:

%%javascript
Jupyter.utils.load_extensions('vim_binding/vim_binding');