[TxMt] Re: highliting opening braces

David Green david.green at telus.net
Thu Nov 13 06:14:53 UTC 2014


On 2014-November-11, at 9:28 am, Allan Odgaard wrote:
>> Is there a way to also get TM to highlight the opening brace, when you actually type the closing brace too?
> This is not possible: The reason is that the animation is distracting. I have a note about implementing a less distracting (permanent) highlight that could be used during typing or when caret is on the item.

Hm, is it particularly more distracting than when moving the cursor?  But permanent highlighting sounds interesting… something like the “focus” highlighting in Xcode, perhaps?  (For anyone who hasn’t seen it, that dims the outermost scope slightly, and the next outermost scope slightly more, and so on. There’s a picture here: http://apple.stackexchange.com/questions/75745/xcode-4-key-binding-for-focus-code-blocks-on-hover ) It makes it easy to identify the entire block rather than a single character, and without distractions. I’d definitely appreciate a feature like that.


Anyway, if you really want a closing brace to flash its opening mate, a slightly ugly hack is to make a shortcut to type “}” followed by a left-arrow and a right-arrow. A Textmate macro won't quite work, presumably since you’re not actually pressing the right-arrow key, but you can program the amazing Karabiner (https://pqrs.org/osx/karabiner) to do it by adding this to its private.xml:

  <item>
    <name>Textmate Brace Closer</name>
    <appendix>Turn "}" into  }←→ to flash the opening brace</appendix>
    <identifier>private.bracer</identifier>    
    
	<appdef>
	  <appname>TEXTMATE</appname><equal>com.macromates.TextMate.preview</equal>
	</appdef>
    <only>TEXTMATE</only>
	
    <autogen>--KeyToKey-- KeyCode::BRACKET_RIGHT, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT,  KeyCode::BRACKET_RIGHT, ModifierFlag::SHIFT_L, KeyCode::CURSOR_LEFT, KeyCode::CURSOR_RIGHT</autogen>
  </item>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20141112/d24a70a9/attachment.html>


More information about the textmate mailing list