I am trying to use the %ed magic in IPython to use vim as the editor.
- vim is installed
- ipython and ipython qtconsole both work
- zsh is latest as updated with my oh-my-zsh install
I exported my prefernce to zsh
$ echo "export EDITOR=/usr/bin/vim" >> ~/.zshrc
$ echo "export VISUAL=/usr/bin/vim" >> ~/.zshrc
However, when I launch IPython and then invoke the %ed magic it fails
In [1]: %ed
IPython will make a temporary file named: /tmp/ipython_edit_pu4Yql.py
Editing.../bin/sh: 1: mvim: not found
WARNING: Could not open editor
How do I get this to work?
Try using IPython's profile configuration as a means of specifying editor. To do this:
Firstly, generate default configuration files:
Next, find your
~/.ipython/profile_default/..._config.py
file to edit. For example on IPython 2.4.1,Find the commented-out
.editor
setting, un-comment, and set it tovim
. For example in IPython 2.4.1, this would look likeYou will now find when you start IPython, you can
%ed
and it will call up vim:Explanation
man ipython
:IPYTHONDIR
according toman ipython
:Also I mention the version because settings seem different across some versions, for 2.4.1 the setting is called:
Whereas in the answer given at IPython setting text editor, this setting was named differently:
Since it seems different between versions, after you generate the default configuration files, check and see how it is written in your IPython version, and act accordingly.