[~] Refactor

This commit is contained in:
Siarhei Siniak 2022-09-30 13:23:16 +03:00
parent c0636f8f46
commit 6427bbd071

@ -3,13 +3,16 @@ c.InteractiveShellApp.exec_lines = [
r'''
def ipython_update_shortcuts():
import IPython
import prompt_toolkit.filters
t1 = IPython.get_ipython()
t2 = t1.pt_app
t3 = [o for o in t2.key_bindings.bindings if 'f2' in repr(o).lower()]
assert len(t3) == 1
t4 = t3[0]
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()',
]