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.
good luck, Eric
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@math.sfsu.edu http://math.sfsu.edu/hsu _______________________________________________ textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/mailman/listinfo/textmate
On 30-11-2004 17:47, kumar mcmillan wrote:
- Pattern: ^(\d+):(.*)$
[this parses out the grep output so we can identify the line part]
- Format: $2
- Line:1
I didn't really understand the Line / Format boxes in the command dialog.
The Pattern is a regular expression (see TM help) and the () define two groups, which can be addressed with $1 (the \d+ match) and $2 (the .* match). The Format box then allows you to format the output such as you like, in this case it only shows the last group.
And what the Line box does I'm not sure.
Jeroen.
On Nov 30, 2004, at 19:19, Jeroen van der Ham wrote:
- Pattern: ^(\d+):(.*)$
[this parses out the grep output so we can identify the line part]
- Format: $2
- Line:1
I didn't really understand the Line / Format boxes in the command dialog.
The Pattern is a regular expression (see TM help) and the () define two groups, which can be addressed with $1 (the \d+ match) and $2 (the .* match). The Format box then allows you to format the output such as you like, in this case it only shows the last group.
And what the Line box does I'm not sure.
The File register/Line/Column boxes tell which group (i.e. regex capture register) contain the filename, line number and column number. In this case there is only the line number (so current file is assumed).
The documentation for this is in Help -> Commands.
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@math.sfsu.edu http://math.sfsu.edu/hsu _______________________________________________ textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/mailman/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/mailman/listinfo/textmate
Dominique PERETTI http://www.lachoseinteractive.net