One powerful feature of IPython is its integration with text editors. On Mac and Linux the default editor is vim.
If you are using Sublime Text 3 as your editor, here's how to configure it to be called when you run the edit magic command in an iPython session.
Make a symlink to subl (which is Sublime Text's tool to work with files on the command line).
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
The above assumes that you have installed Sublime Text in the Applications folder and you have set the ~/bin folder in your path.
Edit your .bash_profile file as follows :
To test your configuration open a terminal and start ipython. We will try out the example from the iPython documentation :
In : edit Editing... done. Executing edited code... Out: 'def foo():\n print "foo() was defined in an editing session"\n
We can then call the function foo() :
In : foo() foo() was defined in an editing session
Now we edit foo. IPython automatically loads the editor with the (temporary) file where foo() was previously defined:
In : edit -p Editing... done. Executing edited code...
And if we call foo() again we get the modified version:
In : foo() foo() has now been changed!