Nat*_*tal 5 ipython jupyter-notebook
在ipython 2.1.0中,我们有编辑模式和命令模式。输入单元格后,ctrl-enter 将评估该单元格并聚焦于当前单元格,但离开编辑模式。因此,如果我需要继续编辑单元格,则需要按额外的“Enter”键。有没有办法使默认行为保持编辑模式?
您可以使用 IPython javascript API 来修改快捷方式。
如果您使用该IPython.keyboard_manager.edit_shortcuts.add_shortcut命令,您可以更改 ctrl-enter 快捷键以不更改焦点。
%%javascript
IPython.keyboard_manager.edit_shortcuts.add_shortcut('ctrl-enter', {
help : "run cell and keep focus", //This is optional
handler : function (event) {
IPython.notebook.execute_cell();
IPython.notebook.edit_mode();
return false;
}}
);
Run Code Online (Sandbox Code Playgroud)
如果您需要编辑命令模式的快捷方式,可以edit_shortcuts将 替换为。command_shortcuts
同样,如果您需要删除现有快捷方式,则add_shortcut可以替换为。remove_shortcut
| 归档时间: |
|
| 查看次数: |
3502 次 |
| 最近记录: |