gpt4 book ai didi

jupyter-notebook - Jupyter中的Atom/Sublime如多项选择

转载 作者:行者123 更新时间:2023-12-03 23:45:14 24 4
gpt4 key购买 nike

如何通过键盘快捷键在Jupyter笔记本中选择匹配的关键字?例如,在Atom / Sublime编辑器中,当光标位于“ var”上方时,我可以在Mac上按cmd + D(在Windows上为Ctrl + d),每次执行此操作时,下一个“ var”将被突出显示。然后,我可以键入新的变量名,并用我键入的任何内容替换“ var”。

var = "hello"
print(var)
print(var)


Jupyter笔记本中是否有类似产品?

最佳答案

custom.js添加到

C:\Users\username\.jupyter\custom      # for Windows and 
~/.jupyter/custom/ # for Mac


有内容

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) {}
});
}
}
);


然后重新启动jupyter。现在 Ctrl+D应该像在 Sublime中一样工作。

您会看到 Ctrl-Enter功能被禁用,因为对于大多数用户而言,运行当前单元格比创建新行非常方便。您可以通过注释掉该行来选择具有该功能。

您可以通过类似的方式禁用不需要的其他键配置。

enter image description here

关于jupyter-notebook - Jupyter中的Atom/Sublime如多项选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41553806/

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