[~] Refactor
This commit is contained in:
parent
c0636f8f46
commit
6427bbd071
@ -3,13 +3,16 @@ c.InteractiveShellApp.exec_lines = [
|
|||||||
r'''
|
r'''
|
||||||
def ipython_update_shortcuts():
|
def ipython_update_shortcuts():
|
||||||
import IPython
|
import IPython
|
||||||
|
import prompt_toolkit.filters
|
||||||
t1 = IPython.get_ipython()
|
t1 = IPython.get_ipython()
|
||||||
t2 = t1.pt_app
|
t2 = t1.pt_app
|
||||||
t3 = [o for o in t2.key_bindings.bindings if 'f2' in repr(o).lower()]
|
t3 = [o for o in t2.key_bindings.bindings if 'f2' in repr(o).lower()]
|
||||||
assert len(t3) == 1
|
assert len(t3) == 1
|
||||||
t4 = t3[0]
|
t4 = t3[0]
|
||||||
t2.key_bindings.remove(t4.handler)
|
t2.key_bindings.remove(t4.handler)
|
||||||
t2.key_bindings.add('i')(t4.handler)
|
t2.key_bindings.add(
|
||||||
|
'e', filter=~prompt_toolkit.filters.vi_insert_mode,
|
||||||
|
)(t4.handler)
|
||||||
''',
|
''',
|
||||||
'ipython_update_shortcuts()',
|
'ipython_update_shortcuts()',
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user