在 Jupyter notebook 中选择 运行所有
、运行以上所有
或者 运行以下所有
后,如何跳转到当前正在运行的单元格?
在 Jupyter notebook 中选择 运行所有
、运行以上所有
或者 运行以下所有
后,如何跳转到当前正在运行的单元格?
~/.jupyter/custom/custom.js
:// Go to Running cell shortcut
Jupyter.keyboard_manager.command_shortcuts.add_shortcut('Alt-I', {
help : 'Go to Running cell',
help_index : 'zz',
handler : function (event) {
setTimeout(function() {
// Find running cell and click the first one
if ($('.running').length > 0) {
//alert("found running cell");
$('.running')[0].scrollIntoView();
}}, 250);
return false;
}
});
现在你可以随时按下Alt-I
,使笔记本重新将视图聚焦到正在运行的单元格。
接下来,编写一个扩展程序/快捷方式,使当前运行单元格的视图在整个执行期间保持聚焦,这将更好。
虽然不是特别优雅,但当我需要自定义功能时,我会使用jupyter的custom.js。
下面的代码段绑定了按钮的点击事件并选择当前正在执行的单元格。您可以将其放置在~/.jupyter/custom/custom.js
中。
$('#run_all_cells, #run_all_cells_above, #run_all_cells_below').click(function() {
setTimeout(function() {
// Find running cell and click the first one
if ($('.running').length > 0) {
$('.running')[0].click();
}
}, 250);
});