Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable auto-quotes and auto-brackets in Jupyter 5.0

I upgraded Jupyter to the latest vesion, 5.0, and it looks like my front-end configuration stopped working.

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.

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; }) 

I've read that since Jupyter 4 this code could be changed by:

IPython.CodeCell.options_default.cm_config.autoCloseBrackets = false; 

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/en/latest/frontend_config.html#frontend-config

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:

enter image description here

like image 555
Marc Garcia Avatar asked May 27 '17 11:05

Marc Garcia


People also ask

How do I enable auto quotes in Jupyter notebook?

You have auto-complete in Jupyter notebooks like you have in any other Jupyter environment. Simply hit the “Tab” key while writing code. This will open a menu with suggestions. Hit “Enter” to choose the suggestion.

What does %% do in Jupyter notebook?

IPython Magic – Timing These are especially handy when you have some slow code and you're trying to indentify where the issue is. %%time will give you information about a single run of the code in your cell.

How do you stop a script in Jupyter notebook?

Stopping a process or restarting a Jupyter Notebook To interrupt a cell execution, you can click the ■ “stop” button in the ribbon above the notebook, or select “Interrupt Kernel” from the Kernel menue.


1 Answers

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}}}) 

This creates a file ~/.jupyter/nbconfig/notebook.json with the content:

{   "CodeCell": {     "cm_config": {       "autoCloseBrackets": false     }   } } 

After executing the Python command, or manually creating the file, restart your Jupyter notebook, and it should stop auto-closing quotes and brackets.

like image 112
Marc Garcia Avatar answered Sep 20 '22 04:09

Marc Garcia