gpt4 book ai didi

windows - 在 jupyter notebook 中禁用 Ctrl+Enter sublime keymap

转载 作者:可可西里 更新时间:2023-11-01 13:28:32 24 4
gpt4 key购买 nike

我通过将以下内容添加到我的 Jupyter custom.js 来使用 Jupyter Notebook 和 Sublime Text 键盘映射:

require(["codemirror/keymap/sublime", "notebook/js/cell"], 
function(sublime_keymap, cell) {
cell.Cell.options_default.cm_config.keyMap = 'sublime';
});

...大部分情况下效果很好,除了我在 Windows 机器上,这将“insertLineAfter”的 Sublime 功能添加到 Ctrl+Enter 的绑定(bind)中,我不想要它,因为 Ctrl+Enter 是绑定(bind)以执行 Jupyter 中的当前单元格。

有谁知道如何禁用 Ctrl+Enter 的“insertLineAfter”绑定(bind)吗?

最佳答案

以下对我有用:

require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],
function(sublime_keymap, cell, IPython) {
cell.Cell.options_default.cm_config.keyMap = 'sublime';
cell.Cell.options_default.cm_config.extraKeys["Ctrl-Enter"] = function(cm) {}
var cells = IPython.notebook.get_cells();
for(var cl=0; cl< cells.length ; cl++){
cells[cl].code_mirror.setOption('keyMap', 'sublime');
cells[cl].code_mirror.setOption("extraKeys", {
"Ctrl-Enter": function(cm) {}
});
}
}
);

关于windows - 在 jupyter notebook 中禁用 Ctrl+Enter sublime keymap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36384921/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com