Skip to content

Commit 4dc32dd

Browse files
committed
Fix run_these_lines() maps
1 parent 0437e45 commit 4dc32dd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ftplugin/python/ipy.vim

+7-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,13 @@ augroup END
149149
noremap <Plug>(IPython-RunFile) :update<CR>:Python2or3 run_this_file()<CR>
150150
noremap <Plug>(IPython-ImportFile) :update<CR>:Python2or3 run_this_file('-n')<CR>
151151
noremap <Plug>(IPython-RunLine) :Python2or3 run_this_line()<CR>
152-
noremap <Plug>(IPython-RunLines) :Python2or3 run_these_lines()<CR>
152+
if has('python3') && get(g:, 'pymode_python', '') !=# 'python'
153+
noremap <Plug>(IPython-RunLines) :python3 run_these_lines()<CR>
154+
xnoremap <Plug>(IPython-RunLinesAsTopLevel) :python3 dedent_run_these_lines()<CR>
155+
else
156+
noremap <Plug>(IPython-RunLines) :python run_these_lines()<CR>
157+
xnoremap <Plug>(IPython-RunLinesAsTopLevel) :python dedent_run_these_lines()<CR>
158+
endif
153159
noremap <Plug>(IPython-OpenPyDoc) :Python2or3 get_doc_buffer()<CR>
154160
noremap <Plug>(IPython-UpdateShell) :Python2or3 if update_subchannel_msgs(force=True): echo("vim-ipython shell updated",'Operator')<CR>
155161
noremap <Plug>(IPython-ToggleReselect) :Python2or3 toggle_reselect()<CR>
@@ -162,7 +168,6 @@ noremap <Plug>(IPython-ToggleSendOnSave) :call <SID>toggle_send_on_save()<CR>
162168
noremap <Plug>(IPython-PlotClearCurrent) :Python2or3 run_command("plt.clf()")<CR>
163169
noremap <Plug>(IPython-PlotCloseAll) :Python2or3 run_command("plt.close('all')")<CR>
164170
noremap <Plug>(IPython-RunLineAsTopLevel) :Python2or3 dedent_run_this_line()<CR>
165-
xnoremap <Plug>(IPython-RunLinesAsTopLevel) :Python2or3 dedent_run_these_lines()<CR>
166171
167172
function! s:DoMappings()
168173
let b:did_ipython = 1

0 commit comments

Comments
 (0)