Home Download Buy Blog Forum Support

Bracket highlighting

Bracket highlighting

Postby gpfsmurf on Thu Mar 19, 2009 5:29 pm

Bracket highlighting seems to work only with parenthesis.

It would be nice if it also worked with other kinds of brackets (greater/smaller than, curly brackets, square brackets) and if possible, with string delimiters (single quotes, double quotes, python's triple double quotes, etc)

Bracket matching and bracket scope selection have the same problem (ctrl-m and ctrl-shift-m)
gpfsmurf
 
Posts: 211
Joined: Mon Jun 23, 2008 6:31 pm

Re: Bracket highlighting

Postby gpfsmurf on Fri Mar 20, 2009 6:12 pm

Woops... forgot about that. My matchBracketsBraces was set to false by default.
Let's hope for a matchBracketsAngle now :)
gpfsmurf
 
Posts: 211
Joined: Mon Jun 23, 2008 6:31 pm

Re: Bracket highlighting

Postby jps on Wed Jun 03, 2009 1:48 pm

Bracket matching vs. angle brackets will be available in the next beta.

sublimator wrote:Yeah, another thing is the lack of auto closing with {} I think that's something that should come by default with Sublime.


This isn't there for all the C style languages, where it'd be an annoyance. There's no reason it couldn't be added for languages where it makes sense though, like Python.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Bracket highlighting

Postby EJ12N on Wed Jun 03, 2009 6:45 pm

sublimator wrote:Yeah, another thing is the lack of auto closing with {} I think that's something that should come by default with Sublime.

It would be quite nice if the highlighting worked some how for xml tags and if one of the ends wasn't visible then it show up quite visibly on the minimap.


I agree it would be very nice to have highlighted matching xml/html tags (ala notepad++)

for the other one sublime flexibility allows you to do it... (I agree it should be there by default tho)

Curly Braces.sublime-snippet
Code: Select all
<snippet>
   <content><![CDATA[{${0:$SELECTION}}]]></content>
</snippet>


Add this to Default.sublime-keymap if you want it to work global like [] and parenthesis (I did)
If you want it language specific, put it in the right Default.sublime-keymap under X language folder (ex: PHP\Default.sublime-keymap)
Code: Select all
  <!-- Auto curly braces -->
  <binding key="}" command="move characters 1">
    <context name="option" value="autoMatchEnabled"/>
    <context name="allSelectionsEmpty" value="true"/>
    <context name="allFollowingCharacter" value="}"/>
  </binding>
  <binding key="{" command="insertSnippet 'Packages/Default/Curly Braces.sublime-snippet'">
    <context name="option" value="autoMatchEnabled"/>
    <context name="allSelectionsEmpty" value="true"/>
    <context name="allFollowingText" value="^(\t| |]|$)"/>
  </binding>
  <binding key="{" command="insertSnippet 'Packages/Default/Curly Braces.sublime-snippet'">
    <context name="option" value="autoMatchEnabled"/>
    <context name="allSelectionsNonEmpty" value="true"/>
  </binding>
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Bracket highlighting

Postby vim on Wed Jun 03, 2009 8:26 pm

<context name="allFollowingText" value="^(\t| |]|$)"/>


change ] to }

<context name="allFollowingText" value="^(\t| |}|$)"/>
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Bracket highlighting

Postby jps on Thu Jun 04, 2009 5:04 am

Not like that, no: just simple, character based matching of angle brackets, i.e:

Code: Select all
|<a href="">|
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Bracket highlighting

Postby EJ12N on Thu Jun 04, 2009 5:06 pm

sublimator wrote:
Bracket matching vs. angle brackets will be available in the next beta.


Code: Select all
<p>
   |<b>
      <a href=""></a>
   </b>|
</p>


Like that, where | => lovely little underscore dressing? Awesomeness, cause I use Genshi, an xml based templating language for some sites. It's a great little lib but it's very fragile. "Error: Unmatched Tag"


Not like that, no: just simple, character based matching of angle brackets


I would say both are good, but if I have to pick one I would go with sublimator one, which is the one in notepad++
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Bracket highlighting

Postby jps on Fri Jun 05, 2009 3:43 am

I agree it'd be a useful feature, but it has to be prioritised along with everything else. Simple angle bracket matching is a separate case, as it's already implemented, just not exposed in current versions.

Fancier XML related functionality is the sort of thing that should be implementable via plugins, especially when the API allows plugins to add markers etc
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Next

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 13 guests