Var*_*nga 8 ipython jupyter jupyter-notebook
我刚开始使用 jupyter notebook。谷歌搜索没有帮助。谢谢!
更新:答案的快速摘要
在启动 ipython 文件之前在单元格中运行以下代码为我完成了任务。一个问题是我们必须每次都为每个文件运行它。
%%javascript
// 将设置应用到所有当前 CodeMirror 实例
IPython.notebook.get_cells().map(
function(c) { return c.code_mirror.options.indentWithTabs=true; }
);
// 确保将来创建的新 CodeMirror 实例也使用此设置
CodeMirror.defaults.indentWithTabs=true;
如果您在单元格中运行此 javascript 代码,它应该允许您插入硬标签:
%%javascript
IPython.tab_as_tab_everywhere = function(use_tabs) {
if (use_tabs === undefined) {
use_tabs = true;
}
// apply setting to all current CodeMirror instances
IPython.notebook.get_cells().map(
function(c) { return c.code_mirror.options.indentWithTabs=use_tabs; }
);
// make sure new CodeMirror instances created in the future also use this setting
CodeMirror.defaults.indentWithTabs=use_tabs;
};
IPython.tab_as_tab_everywhere()
Run Code Online (Sandbox Code Playgroud)
这个对我有用。来源 = http://pirsquared.org/blog/indenting-tabs.html
| 归档时间: |
|
| 查看次数: |
15847 次 |
| 最近记录: |