Hacker News new | past | comments | ask | show | jobs | submit login

The writer's remark:

'''...after prototyping in the notebook, I usually refactor some of my code into individual Python files so that I can edit more comfortably using my preferred text editor. I then import those modules [back] in the...notebook.'''

I found this to be quite a headache myself, going between the iPython notebook and vim, until I discovered this great Firefox addon called "It's all text" [not affiliated] -- for those unaware, it lets you pop open a gui editor of your choice, whereupon you can send the text entered from that back down into the iPython notebook. Doing it this way you get the best of both worlds.




We're thinking of ways to improve moving code from a notebook into a module. One idea we're currently hoping to develop is a 'modulify' function/button, which will save a cell to a Python file and replace the cell contents with import statements.


Wasn't there some "export" function for .py files?


You can export a notebook as a .py file, or you can save segments of your history into a .py file. But it would be nice to have something a bit more convenient as you're developing code in a notebook, when you find you want to move a couple of functions to a module but keep using them in that notebook.

We also plan to have a simple text file editor so that you can work on a module in the same environment. We're not going to try to build an entire web-based IDE, though.


Vimperator also has this by default (^i triggers it I believe). Then you never have to have the disorientation of leaving a vim environment :-)


I use the mentioned "It's all Text" in Firefox (to pop open gvim) alongside another addon called "Vim Fx"; these two addons together provide for a far superior experience than the vanilla iPython notebook. Though I'm still hoping they integrate vim keybindings eventually -- I've noticed that there are some branches on github w/ these, but can hardly wait to see that kind of thing surface in master.


Awesome, didn't realize it worked in pentadactyl as well.

One small caveat: i use macvim, it opens a new window in macvim, i close/sync it with :wq. Any idea how I can have it so it jumps back to the firefox window instead another macvim window?


I found this on the MacVim wiki.

    mvim -f --nomru -c "au VimLeave * !open -a Terminal"'
for refocusing the terminal after editing a commit message. Think it'll work fine if you change Terminal to Firefox. The --nomru is to make sure the file isn't added to the recently edited files list, which is also helpful.


It does, thank you. For others, this is my solution for now:

set editor='mvim --nomru -f +<line> +"sil! call cursor(0, <column>)" <file> -c "au VimLeave * !open -a Firefox"'


there is the %edit magic, too bad that it doesn't appear to work (at least not now that I tested) with the web notebooks. it works in qtconsole though. and then there is the emacs ipython notebook mode which is kinda interesting. i'm currently in progress of evaluating it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: