Giter VIP home page Giter VIP logo

ipython-vimception's Introduction

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.

ipython-vimception's People

Contributors

bwillers avatar davclark avatar ivanov avatar ketch avatar nbren12 avatar richardwarfield avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.