Notebook: Menu Option to Disable Auto Close Brackets

Created on 13 Jul 2017  路  3Comments  路  Source: jupyter/notebook

Reposting comment from: https://github.com/jupyter/notebook/issues/2040#issuecomment-283764115
/CC @jdriordan

It would be great to have something along the lines of:

# Run this in Python once, it should take effect permanently
from notebook.services.config import ConfigManager
c = ConfigManager()
c.update('notebook', {"CodeCell": {"cm_config": {"autoCloseBrackets": False}}})

as a menu option to make the feature more accessible and discoverable.

Most helpful comment

I'm not a new jupyter user but finally I decided to dig into this and found here. Automatic brackets annoys me a lot because:

  • when I want to change something, I get brackets at the wrong place or missing brackets

    • x = [list comprehension], oops, I need a set.

    • x = some(proc(ess(data))), oops, I missed another call on my data.

    • db.execute('xxxx', key). Oops, the second arg should be a one-element tuple, place the cursor and type ( move then ,). Oh, there is a SyntaxError because my last ) is eaten.

  • I have to type them to jump after the closing ones (or move my right hand away to reach to the right arrow key)

All 3 comments

I think this is a great idea. Automatic brackets can be unfamiliar/infuriating to new jupyter users and the current solution of copypasting an SO answer is less than ideal.

I'm not a new jupyter user but finally I decided to dig into this and found here. Automatic brackets annoys me a lot because:

  • when I want to change something, I get brackets at the wrong place or missing brackets

    • x = [list comprehension], oops, I need a set.

    • x = some(proc(ess(data))), oops, I missed another call on my data.

    • db.execute('xxxx', key). Oops, the second arg should be a one-element tuple, place the cursor and type ( move then ,). Oh, there is a SyntaxError because my last ) is eaten.

  • I have to type them to jump after the closing ones (or move my right hand away to reach to the right arrow key)

The above code in the OP doesn't seem to work on AWS SageMaker when using JupiterLab

Was this page helpful?
0 / 5 - 0 ratings