问题描述
我将Jupyter升级到了最新的vesion 5.0,并且看起来我的前端配置停止工作了.
I upgraded Jupyter to the latest vesion, 5.0, and it looks like my front-end configuration stopped working.
我不明白为什么Jupyter默认会自动将引号和方括号括起来,我觉得这很烦人.因此,在每个版本中,我都必须更改设置以将其禁用.
I don't understand why Jupyter comes with auto closing quotes and brackets by default, which I find pretty annoying. So, at each version I have to change the settings to disable it.
它曾经通过创建文件~/.jupyter/custom/custom.js
并添加下一个JavaScript代码来工作:
It used to work by creating a file ~/.jupyter/custom/custom.js
and adding the next JavaScript code:
require(['notebook/js/codecell'], function (codecell) {
codecell.CodeCell.options_default.cm_config.autoCloseBrackets = false;
})
我已经读过,自Jupyter 4起,可以通过以下方式更改此代码:
I've read that since Jupyter 4 this code could be changed by:
IPython.CodeCell.options_default.cm_config.autoCloseBrackets = false;
但是看起来在Jupyter 5中,前两个选项停止了工作.
But it looks like in Jupyter 5, the two previous options stopped working.
我发现的有关前端配置的文档没有帮助(一旦了解,我将很乐意对其进行改进):
The documentation I found regarding the front-end configuration is not helpful (I'll be happy to improve it once I understand it):
http://jupyter-notebook.readthedocs.io/zh/latest/frontend_config.html#frontend-config
请问有人可以帮助我了解如何在Jupyter 5中禁用自动括号和自动引号吗?
Can anyone help me understand how to disable auto-brackets and auto-quotes in Jupyter 5 please?
这是我正在运行的确切版本:
This is the exact version I'm running:
推荐答案
看起来可以通过在笔记本中运行来完成:
It looks like it can be done by running in a notebook:
from notebook.services.config import ConfigManager
c = ConfigManager()
c.update('notebook', {"CodeCell": {"cm_config": {"autoCloseBrackets": False}}})
这将创建一个文件~/.jupyter/nbconfig/notebook.json
,其内容为:
This creates a file ~/.jupyter/nbconfig/notebook.json
with the content:
{
"CodeCell": {
"cm_config": {
"autoCloseBrackets": false
}
}
}
执行Python命令或手动创建文件后,重新启动Jupyter笔记本,它应停止自动关闭引号和括号.
After executing the Python command, or manually creating the file, restart your Jupyter notebook, and it should stop auto-closing quotes and brackets.
这篇关于如何在Jupyter 5.0中禁用自动引号和自动括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!