@@ -353,34 +353,40 @@ fun! <SID>toggle_send_on_save()
353353 endif
354354endfun
355355
356- map <silent> <F5> :python run_this_file()<CR>
357- map <silent> <S-F5> :python run_this_line()<CR>
358- map <silent> <F9> :python run_these_lines()<CR>
359- map <silent> <leader> d :py get_doc_buffer()<CR>
360- map <silent> <leader> s :py update_subchannel_msgs(); echo("vim-ipython shell updated",'Operator')<CR>
361- map <silent> <S-F9> :python toggle_reselect()<CR>
362- " map <silent> <C-F6> :python send('%pdb')<CR>
363- " map <silent> <F6> :python set_breakpoint()<CR>
364- " map <silent> <s-F6> :python clear_breakpoint()<CR>
365- " map <silent> <F7> :python run_this_file_pdb()<CR>
366- " map <silent> <s-F7> :python clear_all_breaks()<CR>
367- imap <C-F5> <C-O><F5>
368- imap <S-F5> <C-O><S-F5>
369- imap <silent> <F5> <C-O><F5>
370- map <C-F5> :call <SID> toggle_send_on_save()<CR>
371-
372- " pi custom
373- map <silent> <C-Return> :python run_this_file()<CR>
374- map <silent> <C-s> :python run_this_line()<CR>
375- imap <silent> <C-s> <C-O> :python run_this_line()<CR>
376- map <silent> <M-s> :python dedent_run_this_line()<CR>
377- vmap <silent> <C-S> :python run_these_lines()<CR>
378- vmap <silent> <M-s> :python dedent_run_these_lines()<CR>
379- map <silent> <C-p> :python set_this_line()<CR>
380- map <silent> <M-c> I#<ESC>
381- vmap <silent> <M-c> I#<ESC>
382- map <silent> <M-C> :s/^\([ \t]*\)#/\1/<CR>
383- vmap <silent> <M-C> :s/^\([ \t]*\)#/\1/<CR>
356+ " Allow custom mappings
357+ if ! exists (' g:ipy_perform_mappings' )
358+ let g: ipy_perform_mappings = 1
359+ endif
360+ if g: ipy_perform_mappings != 0
361+ map <silent> <F5> :python run_this_file()<CR>
362+ map <silent> <S-F5> :python run_this_line()<CR>
363+ map <silent> <F9> :python run_these_lines()<CR>
364+ map <silent> <leader> d :py get_doc_buffer()<CR>
365+ map <silent> <leader> s :py update_subchannel_msgs(); echo("vim-ipython shell updated",'Operator')<CR>
366+ map <silent> <S-F9> :python toggle_reselect()<CR>
367+ " map <silent> <C-F6> :python send('%pdb')<CR>
368+ " map <silent> <F6> :python set_breakpoint()<CR>
369+ " map <silent> <s-F6> :python clear_breakpoint()<CR>
370+ " map <silent> <F7> :python run_this_file_pdb()<CR>
371+ " map <silent> <s-F7> :python clear_all_breaks()<CR>
372+ imap <C-F5> <C-O><F5>
373+ imap <S-F5> <C-O><S-F5>
374+ imap <silent> <F5> <C-O><F5>
375+ map <C-F5> :call <SID> toggle_send_on_save()<CR>
376+
377+ " pi custom
378+ map <silent> <C-Return> :python run_this_file()<CR>
379+ map <silent> <C-s> :python run_this_line()<CR>
380+ imap <silent> <C-s> <C-O> :python run_this_line()<CR>
381+ map <silent> <M-s> :python dedent_run_this_line()<CR>
382+ vmap <silent> <C-S> :python run_these_lines()<CR>
383+ vmap <silent> <M-s> :python dedent_run_these_lines()<CR>
384+ map <silent> <C-p> :python set_this_line()<CR>
385+ map <silent> <M-c> I#<ESC>
386+ vmap <silent> <M-c> I#<ESC>
387+ map <silent> <M-C> :s/^\([ \t]*\)#/\1/<CR>
388+ vmap <silent> <M-C> :s/^\([ \t]*\)#/\1/<CR>
389+ endif
384390
385391command ! -nargs =+ IPython :py km_from_string (" <args>" )
386392command ! -nargs =0 IPythonClipboard :py km_from_string (vim .eval (' @+' ))
0 commit comments