File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ augroup END
147147
148148" Setup plugin mappings for the most common ways to interact with ipython.
149149noremap <Plug> (IPython-RunFile) :update<CR> :Python2or3 run_this_file()<CR>
150+ noremap <Plug> (IPython-ImportFile) :update<CR> :Python2or3 run_this_file('-n')<CR>
150151noremap <Plug> (IPython-RunLine) :Python2or3 run_this_line()<CR>
151152noremap <Plug> (IPython-RunLines) :Python2or3 run_these_lines()<CR>
152153noremap <Plug> (IPython-OpenPyDoc) :Python2or3 get_doc_buffer()<CR>
@@ -168,6 +169,7 @@ function! s:DoMappings()
168169 if g: ipy_perform_mappings != 0
169170 if &buftype == ' '
170171 map <buffer> <silent> <F5> <Plug> (IPython-RunFile)
172+ map <buffer> <silent> g<F5> <Plug> (IPython-ImportFile)
171173 endif
172174 " map <buffer> <silent> <S-F5> <Plug>(IPython-RunLine)
173175 map <buffer> <silent> <F9> <Plug> (IPython-RunLines)
Original file line number Diff line number Diff line change @@ -621,15 +621,15 @@ def f_with_update(*args, **kwargs):
621621 return f_with_update
622622
623623@with_subchannel
624- def run_this_file ():
624+ def run_this_file (flags = '' ):
625625 ext = os .path .splitext (vim .current .buffer .name )[- 1 ][1 :]
626626 if ext in ('pxd' , 'pxi' , 'pyx' , 'pyxbld' ):
627627 cmd = ' ' .join (filter (None , (
628628 '%run_cython' ,
629629 vim_vars .get ('cython_run_flags' , '' ),
630630 repr (vim .current .buffer .name ))))
631631 else :
632- cmd = '%%run %s %s' % (vim_vars ['ipython_run_flags' ],
632+ cmd = '%%run %s %s' % (flags or vim_vars ['ipython_run_flags' ],
633633 repr (vim .current .buffer .name ))
634634 msg_id = send (cmd )
635635 print_prompt (cmd , msg_id )
You can’t perform that action at this time.
0 commit comments