[TxMt] Method/function list?
Dominique Peretti
dperetti at lachoseinteractive.com
Thu Dec 2 15:00:25 UTC 2004
That's very cool. I can't believe I overlooked that !!
I modified a little bit mine so I get lines starting with "function".
Additionally, "function" is removed from each line and the result is
sorted alphabetically:
Command :
grep -En "^[^\*/]*(function) [&a-zA-Z0-9_]+" | sort -fbt: +1
Pattern :
^(\d+):(\s*function )(.*)$
Format : $3
On 30 nov. 04, at 17:47, kumar mcmillan wrote:
>
> On Nov 29, 2004, at 7:07 PM, Eric Hsu wrote:
>
>>> I am hoping I¼m just missing something obvious... Is there some
>>> kind of
>>> list of functions/methods? I.e. Similar to BBEdit or SEE¼s popup
>>> function
>>> list?
>>
>> Here's my kludged version of it for Perl using TM commands, which
>> pops up a separate window listing all the subroutines (i.e. lines
>> that begin with 'sub ').
>>
>> Make a command:
>>
>> - before: Do Nothing
>> - Command: grep -n "^sub "
>> - Std In: Entire document
>> - Std out: Show in separate win
>> - Pattern: ^(\d+):(.*)$
>> [this parses out the grep output so we can identify the line part]
>> - Format: $2
>> - Line:1
>>
>> This idea can be tweaked to fit the language of your choice. I think
>> you can pipe it cleverly through sort to get the subroutines
>> alphabetized.
>
> wow! I love TM. Allan are you trying to make us into zealots?
>
> I didn't really understand the Line / Format boxes in the command
> dialog, thanks for posting this Eric. Here is a pattern for PHP files
> :
> grep -En "^[^\*/]*(abstract|public|private|function|class|interface)
> [&a-zA-Z0-9_]+"
>
> it's still not ideal, but between F1, up/down arrows and the Esc key,
> hands don't have to leave the keyboard... great workaround.
>
>
> -k
>
> PS. is there documentation somewhere on how exactly "Format String",
> "File Register", "Line", and "Column" work together?
>
>>
>> good luck, Eric
>> --
>> Eric Hsu, Assistant Professor of Mathematics
>> San Francisco State University
>> erichsu at math.sfsu.edu
>> http://math.sfsu.edu/hsu
>> _______________________________________________
>> textmate mailing list
>> textmate at lists.macromates.com
>> http://lists.macromates.com/mailman/listinfo/textmate
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/mailman/listinfo/textmate
>
Dominique PERETTI
http://www.lachoseinteractive.net
More information about the textmate
mailing list