Here's a link to the abstract and you can watch the video from SciPy 2014 where this talk was presented. The rest of this document are the slides I used in the talk.
Public Service Announcement:
Press Escape
a few times, then :q!
to quit without saving. (save quit with :wq
)
Summary of the talk:
Phrase lifted from an excellent talk by Sam Aaron
Zen and the Art of Live Programming
(I got there via this post from Tom Ballinger, thanks Tom!)
Two-way integration between vim and ipython.
The way to get something done, sit down and talk during the sprints
Min also coined the #vimsorry hashtag for my tweets. Thanks Min!
Vim does not need to be linked against the Python you use.
The Python your Vim is linked against just needs IPython and PyZMQ installed into it.
The powers of BPython and IPython, combined!
https://github.com/ivanov/ipython-vimception
More vi keybindings and convention in the notebook.
dd p
to cut and paste cells around)We use CodeMirror in IPython. CodeMirror supports both vim
and emacs
keyboard shortcuts, but you have to enable them.
Here's how you do that in the notebook.
%%javascript
// change the mode of all current and future CodeMirror instances
function to(mode) {
var mode = mode || 'vim'
// first let's apply vim mode to all current cells
function to_mode(c) { return c.code_mirror.setOption('keyMap', mode);};
IPython.notebook.get_cells().map(to_mode);
// apply the mode to future cells created
IPython.Cell.options_default.cm_config.keyMap = mode;
}
require(["components/codemirror/keymap/vim"],
function (vim) {
to('vim');
console.log('vim.js loaded');
});
What's coming:
vim-ipython:
bipython:
ipython-vimception:
Sam Aaron's Zen and the Art of Live Programming
John Kitchin's Emacs + org-mode + python in reproducible research (SciPy 2013)
John has a dovetailing follow-up talk this year: "A success story in using Python in a graduate chemical engineering course." This room 2:15 p.m.–2:45 p.m.
We use CodeMirror in IPython. CodeMirror supports both vim
and emacs
keyboard shortcuts, but you have to enable them.
Here's how you do that in the notebook.
%%javascript
// change the mode of all current and future CodeMirror instances
function to(mode) {
var mode = mode || 'vim'
// first let's apply vim mode to all current cells
function to_mode(c) { return c.code_mirror.setOption('keyMap', mode);};
IPython.notebook.get_cells().map(to_mode);
// apply the mode to future cells created
IPython.Cell.options_default.cm_config.keyMap = mode;
}
require(["components/codemirror/keymap/emacs"],
function (emacs) {
to('emacs');
console.log('emacs.js loaded');
});
Then, for you, just put a call of: to('emacs') in that curly braces of that function (emacs) callback from earlier (that function's what will be called after the emacs.js file is actually loaded, because trying to call it before that won't work. So your solution should look something like this: