• Stars
    star
    165
  • Rank 228,906 (Top 5 %)
  • Language
    JavaScript
  • Created over 10 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vim-within-Vim in the IPython Notebook.

IPython Vimception

Vim-within-Vim in the IPython Notebook.

In my "Putting the V in IPython" talk at SciPy2014, I spent half of my time talking about ipython-vimception. Here are the slides for the talk.

This is a work in progress. For now, put these files into a folder called vimception (not ipython-vimception) in the extensions subdirectory of whatever ipython locate returns, usually these files go into the ~/.ipython/extensions directory.

Once you do that, in the notebook, just make an execute a cell with:

%load_ext vimception

Once you're satisfied that the above works, you can edit your profile's static/custom/custom.js to have this:

function load_vimception() {
    cell = IPython.notebook.insert_cell_at_index('code', 0);
    IPython.notebook.select(0);
    cell.set_text('%load_ext vimception\n%reload_ext vimception\n%vimception');
    if (!IPython.notebook.kernel) {
        $([IPython.events]).on('status_started.Kernel', function() {
            cell.execute();
            IPython.notebook.delete_cell();
        });
    } else { 
        cell.execute();
        IPython.notebook.delete_cell();
    }
}

$([IPython.events]).on('notebook_loaded.Notebook', function(){
    $('#help_menu').prepend([
            '<li id="vimception" title="load up vimception cell">',
            '<a href="#" title="vimception" onClick="load_vimception()">vimception</a></li>',
            ].join("\n"));

// uncomment next line to *always* start in vimception
// $('#vimception a').click();
});

This allows you to enter vimception by going clicking on Help -> vimception . To leave vimception, save and reload the notebook. If you uncomment the last line to always start vimception, there will not be a way to get out of vimception mode without editing custom.js and then reload the page.

It's all very rough right now, I'm working on it, so hang tight.

TODO

[ ] suppress switching into command mode when moving cursor past the top/bottom lines (using new methods Jonathan added)

[ ] make the multi-level escaping optional (i.e. allow only ctrl-m to take you to command mode)

[ ] look up what else I had in my todo a few weeks ago

[ ] add logic to %vimception to write vimception.json to profile_dir/static/custom - investigate json config in general (Matthias implemented this at some point)

[ ] multi-level undo

[ ] unalias v - and use nb-cccp if it's loaded

[ ] turn it into an nbextension (no python side) - implementing this should close #4 as well

[ ] Ctrl-n and Ctrl-p should work as local completion (like in vim)

[ ] on click, disable the vim fire

[ ] the cell that vimception is started from gets FUBARed :\ or actuall just entering edit mode doesn't work?

[ ] allow going between cells independent of which character you're on

[ ] shift-J on the last line should join cell below

[ ] standardize on a post-load function that vimception will call to allow for further customization.

[ ] look into the codemirror changes here

Related Projects

vim-ipython - A two-way integration between Vim and IPython by the same author.

More Repositories

1

vim-ipython

A two-way integration between Vim and IPython 0.11+
Python
1,031
star
2

bipython

The indiscriminate bicurious interactive python interpreter (bpython + ipython)
Python
99
star
3

kanten

the enlightened pager. less paging. more content. read widely.
Python
21
star
4

popular-front

Jovyan Popular Front: Prototyping UI and UX ideas for Jupyter notebooks (in Elm).
Elm
16
star
5

AY250

notebooks for UC Berkeley's Astronomy 250: "Python Computing for Scientific Research" Spring 2012
10
star
6

nb-cccp

Collective Cut-Copy-Paste for IPython Notebooks
JavaScript
8
star
7

PyPsy

Psychometric function fitting (implemented in Python)
Python
8
star
8

potatoes

I started the day with some nothin' tea. Nothin' tea is easy to make. First, get some hot water, then add nothin'
TypeScript
6
star
9

pyarbus

eyetracking analysis in python
Python
6
star
10

nbutils

utilities for working with ipython notebooks
Python
5
star
11

occu.py

a sign I made for the West Coast Port Shutdown
Python
5
star
12

ipython-trainingwheels

A beginner student friendly profile for IPython notebook
JavaScript
4
star
13

scat

Schrรถdinger's cat.
Python
3
star
14

aka

Simple, persistent, shell-based command aliasing
Shell
3
star
15

attending

Python
2
star
16

jpy

A lightweight Jeopardy clone using wxPython
Python
2
star
17

cellout

rich notebook conversion
Jupyter Notebook
2
star
18

xkcd-font

XKCD Font
2
star
19

scipy2014

Putting the V in IPython talk slides
Python
1
star
20

yippee-cahier

vi hard!
1
star
21

nose-pynotify

Visual notifications for nose tests on Linux.
Python
1
star
22

fibdb

Efficienct generation and storage of Fibonacci numbers, 1000x faster than Hadoop
Python
1
star
23

jlsp-test-drive

testdrive of JupyterLab-LSP
Jupyter Notebook
1
star