Home Download Buy Blog Forum Support

Auto insert paired curly brackets and others

Auto insert paired curly brackets and others

Postby artee on Thu Jun 18, 2009 11:23 am

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
artee
 
Posts: 32
Joined: Sat May 30, 2009 10:33 pm

Re: Auto insert paired curly brackets and others

Postby vim on Thu Jun 18, 2009 11:51 am

i was wondering too...
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Auto insert paired curly brackets and others

Postby EJ12N on Thu Jun 18, 2009 3:11 pm

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.
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Auto insert paired curly brackets and others

Postby jps on Thu Jun 18, 2009 10:48 pm

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:

Code: Select all
{|}


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

Code: Select all
{
    |
}
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Auto insert paired curly brackets and others

Postby jps on Sat Jun 20, 2009 9:10 am

sublimator wrote:ooh lovely, macro in next release? I never use C but JavaScript every now and then


Yep, both the above mentioned items are in 20090620
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 7 guests