Apo*_*tus 11 startup ipython ipython-notebook jupyter jupyter-notebook
我有以下快捷方式配置,在Jupiter笔记本的单元格中运行后可以正常工作:
%%javascript
IPython.keyboard_manager.command_shortcuts.add_shortcut('ctrl-q', {
help: 'Clear all output', // This text will show up on the help page (CTRL-M h or ESC h)
handler: function (event) { // Function that gets invoked
if (IPython.notebook.mode == 'command') {
IPython.notebook.clear_all_output();
return false;
}
return true;
}
});
Run Code Online (Sandbox Code Playgroud)
如何设置Jupiter笔记本以在启动时自动进行初始化?
我尝试添加相同的代码(没有%%javascript)C:\Users\<username>\.ipython\profile_default\static\custom\custom.js但它没有用.
我只有一个配置文件,使用ipython profile createPython 3.3,Windows 7创建.
提前致谢.
custom.js是此代码的正确位置.尝试将其包装如下(不要忘记return true在块结束之前):
$([IPython.events]).on("app_initialized.NotebookApp", function () {
<your code>
return true;
});
Run Code Online (Sandbox Code Playgroud)
在新版本的Jupyter笔记本中(使用pip install --upgrade notebook或者使用conda更新它conda upgrade notebook),您可以从笔记本本身自定义它们.
要做到这一点Help- >Edit keyboard shortcuts
1. 更改命令模式快捷键:参考 Salvador 的回答
2. 更改编辑模式快捷键:
编辑文件~/.jupyter/nbconfig/notebook.json,如https://jupyter-notebook.readthedocs.io/en/stable/extending/keymaps.html 所述
例如,将执行代码的 control-enter 快捷方式替换为 macOS 上的 command-enter 后,文件如下所示:
{
"Notebook": {
"Toolbar": true,
"Header": true
},
"Cell": {
"cm_config": {
"lineNumbers": true
}
},
"keys": {
"command": {
"unbind": [
"ctrl-enter"
],
"bind": {
"cmdtrl-enter": "jupyter-notebook:run-cell"
}
},
"edit": {
"unbind": [
"ctrl-enter"
],
"bind": {
"cmdtrl-enter": "jupyter-notebook:run-cell"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4848 次 |
| 最近记录: |