Skip to content

Commit

Permalink
invoke IPython's run magic as %run instead of run
Browse files Browse the repository at this point in the history
If the source file defines or imports a symbol named 'run', that symbol
takes precedence over IPython's run, leading to a syntax error being
thrown when invoking run_this_file()

Using %run removes the ambiguity.
  • Loading branch information
Marcel Wolf committed Aug 28, 2013
1 parent 7e948b1 commit 774e341
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ftplugin/python/ipy.vim
Expand Up @@ -431,8 +431,8 @@ def with_subchannel(f,*args):

@with_subchannel
def run_this_file():
msg_id = send('run %s %s' % (run_flags, repr(vim.current.buffer.name),))
print_prompt("In[]: run %s %s" % (run_flags, repr(vim.current.buffer.name)),msg_id)
msg_id = send('%%run %s %s' % (run_flags, repr(vim.current.buffer.name),))
print_prompt("In[]: %%run %s %s" % (run_flags, repr(vim.current.buffer.name)),msg_id)

@with_subchannel
def run_this_line():
Expand Down

0 comments on commit 774e341

Please sign in to comment.