From e4e174d6288afb00fc422ffadf73cb855d482a1d 2011-10-17 03:02:53
From: Fernando Perez <Fernando.Perez@berkeley.edu>
Date: 2011-10-17 03:02:53
Subject: [PATCH] Add C-m-{'i', '.'} as keybindings for kernel interrupt/restart.

---

diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js
index 084e8f8..e98c41f 100644
--- a/IPython/frontend/html/notebook/static/js/notebook.js
+++ b/IPython/frontend/html/notebook/static/js/notebook.js
@@ -135,6 +135,16 @@ var IPython = (function (IPython) {
                 that.show_keyboard_shortcuts();
                 that.control_key_active = false;
                 return false;
+            } else if (event.which === 73 && that.control_key_active) {
+                // Interrupt kernel = i
+                IPython.notebook.kernel.interrupt();
+                that.control_key_active = false;
+                return false;
+            } else if (event.which === 190 && that.control_key_active) {
+                // Restart kernel = .  # matches qt console
+		IPython.notebook.restart_kernel();
+                that.control_key_active = false;
+                return false;
             } else if (that.control_key_active) {
                 that.control_key_active = false;
                 return true;
@@ -198,6 +208,8 @@ var IPython = (function (IPython) {
             {key: 'Ctrl-m m', help: 'markdown cell'},
             {key: 'Ctrl-m p', help: 'select previous'},
             {key: 'Ctrl-m n', help: 'select next'},
+	    {key: 'Ctrl-m i', help: 'interrupt kernel'},
+	    {key: 'Ctrl-m .', help: 'restart kernel'},
             {key: 'Ctrl-m h', help: 'display keyboard shortcuts'}
         ];
         for (var i=0; i<shortcuts.length; i++) {