From e36bafd16499636ed28f8d463917f7b679955cf4 Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Thu, 10 Aug 2017 12:04:52 -0700 Subject: [PATCH 1/4] Set "sublime" to default keymap for editor --- notebook/static/edit/js/editor.js | 5 +++-- notebook/static/edit/js/menubar.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/notebook/static/edit/js/editor.js b/notebook/static/edit/js/editor.js index 4ab8249021..3c46124b54 100644 --- a/notebook/static/edit/js/editor.js +++ b/notebook/static/edit/js/editor.js @@ -78,10 +78,11 @@ function( extraKeys: { "Tab" : "indentMore", }, + keyMap: 'sublime', indentUnit: 4, theme: "ipython", lineNumbers: true, - lineWrapping: true, + lineWrapping: true }; Editor.prototype.load = function() { @@ -170,7 +171,7 @@ function( Editor: { file_extension_modes: update_mode_map, } - }) + }); }; Editor.prototype.get_filename = function () { diff --git a/notebook/static/edit/js/menubar.js b/notebook/static/edit/js/menubar.js index d7fa05577a..26b4e392f6 100644 --- a/notebook/static/edit/js/menubar.js +++ b/notebook/static/edit/js/menubar.js @@ -125,7 +125,7 @@ define([ }); this.events.on("config_changed.Editor", function () { - var keyMap = editor.codemirror.getOption('keyMap') || "default"; + var keyMap = editor.codemirror.getOption('keyMap') || 'sublime'; that.element.find(".selected-keymap").removeClass("selected-keymap"); that.element.find("#menu-keymap-" + keyMap).addClass("selected-keymap"); }); From 4424b0e46aed875f2a276d06eab402c6fc6e10c1 Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Fri, 11 Aug 2017 10:59:59 -0700 Subject: [PATCH 2/4] Switch back to "default" keycap --- notebook/static/edit/js/editor.js | 1 - notebook/static/edit/js/menubar.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/notebook/static/edit/js/editor.js b/notebook/static/edit/js/editor.js index 3c46124b54..261ca05028 100644 --- a/notebook/static/edit/js/editor.js +++ b/notebook/static/edit/js/editor.js @@ -78,7 +78,6 @@ function( extraKeys: { "Tab" : "indentMore", }, - keyMap: 'sublime', indentUnit: 4, theme: "ipython", lineNumbers: true, diff --git a/notebook/static/edit/js/menubar.js b/notebook/static/edit/js/menubar.js index 26b4e392f6..a99e09ef42 100644 --- a/notebook/static/edit/js/menubar.js +++ b/notebook/static/edit/js/menubar.js @@ -125,7 +125,7 @@ define([ }); this.events.on("config_changed.Editor", function () { - var keyMap = editor.codemirror.getOption('keyMap') || 'sublime'; + var keyMap = editor.codemirror.getOption('keyMap') || 'default'; that.element.find(".selected-keymap").removeClass("selected-keymap"); that.element.find("#menu-keymap-" + keyMap).addClass("selected-keymap"); }); From 62bc68c5851dbdec27c0ea9b6467260b87a251d0 Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Fri, 11 Aug 2017 11:00:24 -0700 Subject: [PATCH 3/4] Make "extraKeys" consistent for notebook and editor --- notebook/static/edit/js/editor.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/notebook/static/edit/js/editor.js b/notebook/static/edit/js/editor.js index 261ca05028..6c20319cb7 100644 --- a/notebook/static/edit/js/editor.js +++ b/notebook/static/edit/js/editor.js @@ -76,7 +76,15 @@ function( // default CodeMirror options Editor.default_codemirror_options = { extraKeys: { - "Tab" : "indentMore", + "Cmd-Right": "goLineRight", + "End": "goLineRight", + "Cmd-Left": "goLineLeft", + "Tab": "indentMore", + "Shift-Tab" : "indentLess", + // "Cmd-Alt-[" : "indentAuto", + // "Ctrl-Alt-[" : "indentAuto", + "Cmd-/" : "toggleComment", + "Ctrl-/" : "toggleComment", }, indentUnit: 4, theme: "ipython", From f222978992700abd673cdfac95edc93283aa4643 Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Fri, 15 Sep 2017 17:37:04 -0700 Subject: [PATCH 4/4] Remove comments --- notebook/static/edit/js/editor.js | 2 -- notebook/static/notebook/js/cell.js | 2 -- 2 files changed, 4 deletions(-) diff --git a/notebook/static/edit/js/editor.js b/notebook/static/edit/js/editor.js index 6c20319cb7..2c6ccfb666 100644 --- a/notebook/static/edit/js/editor.js +++ b/notebook/static/edit/js/editor.js @@ -81,8 +81,6 @@ function( "Cmd-Left": "goLineLeft", "Tab": "indentMore", "Shift-Tab" : "indentLess", - // "Cmd-Alt-[" : "indentAuto", - // "Ctrl-Alt-[" : "indentAuto", "Cmd-/" : "toggleComment", "Ctrl-/" : "toggleComment", }, diff --git a/notebook/static/notebook/js/cell.js b/notebook/static/notebook/js/cell.js index 41bcd7444a..d445b3ed79 100644 --- a/notebook/static/notebook/js/cell.js +++ b/notebook/static/notebook/js/cell.js @@ -134,8 +134,6 @@ define([ "Cmd-Left": "goLineLeft", "Tab": "indentMore", "Shift-Tab" : "indentLess", - // "Cmd-Alt-[" : "indentAuto", - // "Ctrl-Alt-[" : "indentAuto", "Cmd-/" : "toggleComment", "Ctrl-/" : "toggleComment", }