jupyterlab_emacs
A JupyterLab extension allowing one to edit individual cell contents in jupyter. This is dependent on the edit-server package for Emacs, which also allows you to do similar things from Chrome/Firefox (but crucially, not from fancy textareas like those in Jupyter).
JupterLab Version
The extension has been tested up to JupyterLab version 2.0.0.
Installation
This will eventually work (but currently does not):
jupyter labextension install @stucchio/jupyterlab_emacs
Setting up emacs
To configure emacs, we must use the package edit-server
. We also need to customize this package slightly,
so after installing it you must place the file edit_server_jupyterlab.el
someplace that emacs can find it.
Next up, put the following into your .emacs.d/init.el
file:
(require 'edit-server)
(edit-server-start)
(load-file "path_to_edit_server_jupyterlab.el")
Configuring keyboard shortcuts in Jupyter
Edit-with-emacs is something you probably want to do frequently. Accessing it via the command palette is too slow.
This can be configured in Jupyterlab by going to Settings -> Advanced Settings Editor -> Keyboard Shortcuts, and adding the following under "User Preferences".
This will bind the E
key to edit-in-emacs
, for example.
{
"shortcuts": [
{
"command": "externaleditor:edit-in-emacs",
"keys": [
"E"
],
"selector": ".jp-Notebook:focus"
}
]
}
Development
For a development installation (requires npm version 4 or later), do the following in the repository directory:
npm install
npm run build
jupyter labextension link .
To rebuild the package and the JupyterLab app:
npm run build
jupyter lab build
Credits
Written by Chris Stucchio, and based on code from Jupyterlab Spellchecker which I took as a template.