mirror of
https://github.com/wassname/jupyter_contrib_nbextensions.git
synced 2026-06-27 16:10:24 +08:00
17 lines
556 B
JavaScript
17 lines
556 B
JavaScript
// add new hotkey to toggle comments
|
|
|
|
"use strict";
|
|
var add_edit_shortcuts = {
|
|
'Alt-c' : {
|
|
help : 'Toggle comments',
|
|
help_index : 'eb',
|
|
handler : function () {
|
|
var cm=IPython.notebook.get_selected_cell().code_mirror;
|
|
var from = cm.getCursor("start"), to = cm.getCursor("end");
|
|
cm.uncomment(from, to) || cm.lineComment(from, to);
|
|
return false;
|
|
}
|
|
}
|
|
};
|
|
IPython.keyboard_manager.edit_shortcuts.add_shortcuts(add_edit_shortcuts);
|