Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextMate: Highlight matching tags of caret location

Is it possible for TextMate to syntax highlight the opening and closing tags of your current caret location? And I am talking about constantly, not by pressing a key combo.

Furthermore, if it possible, how can I do it? There doesn't seem to be any way that I know of except by using selectors in the theme, but I don't know if selectors can be context-sensitive.

like image 679
kamranicus Avatar asked Feb 12 '10 16:02

kamranicus


1 Answers

currently, the TextMate language grammar has no concept of cursor position. Therefore, this is not achievable right now.

A workaround that I use is to define macros that select a block of text whose boundaries I define with regular expressions. You have to be handy with regular expressions, but you can make it work.

Essentially, record a new macro (option-command-m), use the find dialog to search for the beginning of the tag. Then, use the find dialog and provide a reg-ex that will match the entire contents you want to select. Press option-command-m again to stop the macro, and then save the macro to a bundle.

An example here:

http://github.com/timcharper/vines.tmbundle/blob/master/Macros/Select%20Tag.tmMacro

Tim

like image 99
Tim Harper Avatar answered Sep 27 '22 18:09

Tim Harper