From c0636f8f4646b4161469981a10187e7260b896ab Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Fri, 30 Sep 2022 13:18:34 +0300 Subject: [PATCH] [~] Refactor --- .../.ipython/profile_default/ipython_config.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dotfiles/.ipython/profile_default/ipython_config.py b/dotfiles/.ipython/profile_default/ipython_config.py index 22e4dc1..e836b40 100644 --- a/dotfiles/.ipython/profile_default/ipython_config.py +++ b/dotfiles/.ipython/profile_default/ipython_config.py @@ -1,4 +1,18 @@ -c.InteractiveShellApp.exec_lines = ['%autoreload 2',] +c.InteractiveShellApp.exec_lines = [ + '%autoreload 2', + r''' +def ipython_update_shortcuts(): + import IPython + 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) + ''', + 'ipython_update_shortcuts()', +] c.InteractiveShellApp.extensions = ['autoreload'] c.InteractiveShell.history_length = 100 * 1000 * 1000 c.InteractiveShell.history_load_length = 100 * 1000 * 1000