[TxMt] Re: TmCodeBrowser 1.03

Charilaos Skiadas cskiadas at uchicago.edu
Sun Nov 6 03:00:13 UTC 2005


On Nov 5, 2005, at 5:32 PM, Scott McDowell wrote:

>> - Added line for HTML <div> sections to the  
>> default .ctags.tmcodebrowser
>>
>
> First off, thank you very much for this plugin.  I don't understand  
> much about
> ctags, and I don't see any of my <div>s showing up yet, but that's  
> cool.
>
Actually, I just downloaded the latest version, and I don't see  
anything for divs either. It seems to catch only a's, h's and img's.
>
> So, in my dream version of TmCodeBrowser, it would list all of my  
> IDed tags like:
>
> Something like that perhaps?  Is this possible with ctags?  Could  
> someone give
> me a pointer on how to configure this?

I am not quite familiar with the ctags syntax, but it seems pretty  
simple. From a terminal, in your home directory, just type:  
"mate .ctags.tmcodebrowser, and scroll down to the html section.
Add the following line:
--regex-html=/<div[ \t]+id[ \t]*=[ \t]*\"([^\"]+)/\1/Divs/i
You could instead use:
--regex-html=/<div[ \t]+id[ \t]*=[ \t]*\"([^\"]+)/div#\1/Divs/i
If you want the thing to appear to be div#the-id instead of just the-id.
If instead you use:
--regex-html=/<([a-zA-Z]*)[ \t]+id[ \t]*=[ \t]*\"([^\"]+)/\1#\2/Ids/i
Then this will (hopefully) catch all tags whose first attribute is  
id, i.e if you have:
<hey id="there"
It will show in the codebrowser: hey#there.
I haven't tested this much, so maybe some else can fine-tune it. In  
any case, I hope it will get you started.

Basically you can pretty much have ctags do whatever you want it to.  
You just specify a line like:
--regex-language=/regexp/name/category/i
where language is the language you want this to work in, regexp is a  
regular expression to be matched, name is the thing you want to  
appear is codebrowser, where you can use \1,\2,\3,.. for the groups  
matched in the regular expression, and category is the general header  
under which you want those to appear. not sure what the /i is  
supposed to do, and what other things you could use instead. This  
document: http://ctags.sourceforge.net/ctags.html, specifically the  
"TAG FILE FORMAT" section, is supposed to explain how this syntax  
works, though I find it a bit lacking in examples. But you'll find  
lots of examples in .ctags.tmcodebrowser.

Haris





More information about the textmate mailing list