[TxMt] TmCodeBrowser2 plugin!

Gerd Knops gerti at bitart.com
Tue Oct 25 15:50:25 UTC 2005


On Tue, Oct 25, at 5:40 AM, Jeroen van der Ham wrote:

> Hi,
>
> This seems pretty cool!
>
Thanks!

> But here's a request for some minimal documentation: What hooks do  
> you use to determine what to display in the code browser? I'd like  
> to use it to navigate LaTeX files as well, if possible...
>
Eventually I hope to hook into the Syntax Coloring engine, so any  
language TM knows would work. Currently though I use the "Exuberant  
CTAGS" [1]. They do not support LaTeX, but if regular expressions  
don't scare you, you can probably come up with some basic LaTeX  
support by creating a ~/.ctags file with just the right lines. Here  
is an example of a real basic and incomplete HTML definition (from  
before ctags had HTML support):

--langdef=html
--langmap=html:.htm.html
--regex-html=/<a[ \t]+href[ \t]*=[ \t]*\"([^\"]+)/\1/HRefs/i
--regex-html=/<img[ \t]+src[ \t]*=[ \t]*\"([^\"]+)/\1/Images/i
--regex-html=/<h([1-6])[^>]*>([^<]*)/\2 (\1)/Headers/i

Basically the --langdef line defines the name of the language, the -- 
langmap line the file extensions. One or more --regex lines then  
define what to parse out of the file, see the ctags manual [2] for  
more details. You can try your entries out in a terminal window  
(replace 'YourSourceFile'):

~/Library/InputManagersManager/TextMate/TmCodeBrowser2.IMMbundle/ 
Contents/Resources/ctags --fields=Kn --excmd=pattern --sort=no -f -  
YourSourceFile

Hope that helps!

Gerd


[1] http://ctags.sourceforge.net/
[2] http://ctags.sourceforge.net/ctags.html




More information about the textmate mailing list