Sublime Forum

Auto insert paired curly brackets and others

#1

Hi All

Why auto inserting of paired curly brackets ({}) and apostrophes (’) are disabled in default configuration?
Curly brackets are widely used in some languages like C, C#, etc…
Apostrophes (’) are widely used in JavaScript or Python as a string delimiters.
Are there any reasons of lack of above characters in default configuration?

regards,
Artur

0 Likes

#2

i was wondering too…

0 Likes

#3

I believe some people find it annoying. I have used numerous editors and a lot of people complain about the editors auto completing characters for them.
For me is convenient but oh well, but to each its own. I do think it should be default though and let the “simplistic” people turn it off. After all, I think sublime market is going to consist of a mostly programmers.

0 Likes

#4

These weren’t included due to the potential to be annoying, but it’s worth reviewing the decision.

Single quotes weren’t initially included because they’re often used by themselves, rather than in pairs. The current auto insertion logic would handle this though, as any characters to the left of the cursor prevent the paired quote from being inserted, so there wouldn’t be any spurious quotes when typing “don’t”, for example.

Curly brackets aren’t matched because the most common use for them is to have two line breaks between them, and having to add them both, then press the up arrow to continue typing, would be an interruption. EJ12N has made a macro though which automates this, which I think is a fantastic:

{|}

Starting with the above, where ‘|’ is the cursor, pressing enter would turn the text into:

{
    |
}
0 Likes

#5

Yep, both the above mentioned items are in 20090620

0 Likes