ivanov / vim-ipython

A two-way integration between Vim and IPython 0.11+
http://github.com/ivanov/vim-ipython
1.04k stars 163 forks source link

python bug #161

Open scholi opened 6 years ago

scholi commented 6 years ago

Hi it seems that running the file by pressing F5 fail because the filename is put into simple quote by using repr . Note: This only works with IPython 4.2 and lower. This can be fixed by changing function run_this_file from _ftpplugin/python/vimipython.py as follow:

@with_subchannel
def run_this_file(flags=''):
    ext = os.path.splitext(vim.current.buffer.name)[-1][1:]
    if ext in ('pxd', 'pxi', 'pyx', 'pyxbld'):
        cmd = ' '.join(filter(None, (
            '%run_cython',
            vim_vars.get('cython_run_flags', ''),
            repr(vim.current.buffer.name))))
    else:
        cmd = '%%run %s "%s"' % (flags or vim_vars['ipython_run_flags'],
                               vim.current.buffer.name)
    msg_id = send(cmd)
    print_prompt(cmd, msg_id)

So mainly removing the repr and adding double quotes arount the %s