Skip to main content

TIL- Multiple cursors in Jupyter

·157 words·1 min
Python Learning

This tutorial by perfectlyrandom.org had been on my TODO list for about 5 months. Today I finally did it! Jeez. I basically failed productivity hacking. Anyway.

xkcd/1205

Multiple cursors are great
#

Multiple cursors are great, and they’re available (mostly by default) in a lot of text editors: Sublime, Atom, PyCharm. They are a yuuuge part of my daily productivity. I don’t know what I’d do without them.

Except that, until now, I had indeed been surviving without them in my other main window of choice: the browser-based Jupyter notebook. Until now. UNTIL NOW!

TLDR tutorial
#

The full tutorial is here. But here’s the tldr of what I did:

cd ~/.jupyter
mkdir custom
subl custom/custom.js

Then, once in custom.js, this worked for me (it’s the first comment):

require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"], function(sublime_keymap, cell, IPython) {

	cell.Cell.options_default.cm_config.keyMap = 'sublime';

	var cells = IPython.notebook.get_cells();

	for (var c=0; c < cells.length ; c++) {
		cells[c].code_mirror.setOption('keyMap', 'sublime');
		}

	});

Aw yiss.

Related

I <3 waves
·1255 words·6 mins
Learning Fun Science
My formal education in physics ended in high school - what a shame!
Power bummer
·1129 words·6 mins
Learning Stats Thinking Data Science
I’ve been thinking a lot about power lately. One of my favorite things!
Automatic desktop backgrounds
·1482 words·7 mins
Tutorial Fun Python
One of my first Python projects was automating a daily desktop background.