DelimiterAutoMatching

DelimiterAutoMatching

is an option for cells and notebooks that specifies whether matching delimiters are automatically inserted when typing Wolfram Language code.

Details

  • DelimiterAutoMatchingTrue causes the typing of certain open delimiters to automatically insert the corresponding closing delimiter after the text caret in affected cells. This setting also causes the typing of a closing delimiter to type through an existing closing delimiter as if you had pressed the right arrow key.
  • Delimiter auto-matching is turned on by default in the Input and Code styles. The option may be toggled globally from the Interface pane of the Preferences dialog.
  • The supported open delimiters and the matched closing delimiters include:
  • []brackets
    [[]]Part brackets
    {}List braces
    ()parentheses
    (**)comment delimiters
    ""string quotes
    <||>Association delimiters
  • DelimiterAutoMatching is only effective in BoxData cells.
  • DelimiterAutoMatching uses heuristics to determine whether it would make sense to auto-match a delimiter in a given context. The heuristics used include:
  • Never auto-match inside of a string.
    Never auto-match if it appears that you are trying to wrap delimiters around an expression.
    Never auto-match or type through if all delimiters in the cell are not matched.
  • DelimiterAutoMatching only triggers if you have an empty text caret selection.

Examples

Basic Examples  (1)

Typing into the cell demonstrates the auto-matching behavior:

Wolfram Research (2021), DelimiterAutoMatching, Wolfram Language function, https://reference.wolfram.com/language/ref/DelimiterAutoMatching.html (updated 2021).

Text

Wolfram Research (2021), DelimiterAutoMatching, Wolfram Language function, https://reference.wolfram.com/language/ref/DelimiterAutoMatching.html (updated 2021).

CMS

Wolfram Language. 2021. "DelimiterAutoMatching." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/DelimiterAutoMatching.html.

APA

Wolfram Language. (2021). DelimiterAutoMatching. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DelimiterAutoMatching.html

BibTeX

@misc{reference.wolfram_2024_delimiterautomatching, author="Wolfram Research", title="{DelimiterAutoMatching}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/DelimiterAutoMatching.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_delimiterautomatching, organization={Wolfram Research}, title={DelimiterAutoMatching}, year={2021}, url={https://reference.wolfram.com/language/ref/DelimiterAutoMatching.html}, note=[Accessed: 22-December-2024 ]}