[IPython-user] turning off the return to editor option

Ryan Krauss ryanlists at gmail.com
Sat Jan 28 08:25:36 CST 2006


Yes, that did help.  I had to do something similar to get vim to work
well with xdvi for inverse search.  This may be obvious to more
experienced vim users, but here is what I did in case this helps
anyone else:

define my fix_editor_hook (saved in a file in my pythonpath called
ipythonhooks.py):
#--------------------------
import os

def fix_error_editor(self,filename,linenum,column,msg):
    cmd='gvim --servername ipython --remote +%d %s'% (linenum,filename,)
    os.system(cmd)
#--------------------------
call this code to set the hook:
import ipythonhooks
ip_set_hook('fix_error_editor',ipythonhooks.fix_error_editor)
#--------------------------
Start gvim with the server name ipython:
gvim --servername ipython

and then ipython and vim play nice together, ipython locates the file
and line number in the already open gvim.

I also set this in my .bashrc file to make starting vim easier:
alias ipvim="gvim --servername ipython"

Thanks for pointing me in the right direction Ville.

Ryan


On 1/28/06, Ville Vainio <vivainio at gmail.com> wrote:
> On 1/28/06, Ryan Krauss <ryanlists at gmail.com> wrote:
>
> > to turn this feature off?  I didn't see a flag in ipythonrc.  I am a
> > gvim user and unless there is a way to set ipython to call a specific
> > vim server this feature doesn't do me much good and I am not yet in
> > the habit of saying no to the prompt.
>
> Would 'editor' and 'fix-error-editor' help you in calling a specific
> vim server? See IPython/hooks.py for details.
>
> --
> Ville Vainio - http://tinyurl.com/2prnb
> http://vainio.blogspot.com
>




More information about the IPython-user mailing list