On 9. Oct 2004, at 22:34, Isaac Rivera wrote:
> I came up with a pretty decent syntax file mysefl.
Okay, Rob also did some ActionScript support:
http://one.textdrive.com/pipermail/textmate/2004-October/000422.html
> Trying to do a class template and have gotten most of it.
>
> Can you tell me how to have the perl script input the date in the
> template file?
>
> Its not one of the shell variables, I know, but maybe its accessible
> to the script.
These questions really belong on the ML, so I'm cc'ing the list :)
You can add your own variables to the environment by changing the
command in the Info.plist, for example here I setup TM_DATE to be
YYYY-MM-DD:
{
name = "Date Test";
extension = "txt";
command = "[ -f $TM_NEW_FILE ] || TM_DATE=`date +%Y-%m-%d` perl -pe
's/\\$\\{([^}]*)\\}/$ENV{$1}/g' <index.html >\"$TM_NEW_FILE\"";
}
So it's basically just 'var=value' before the perl command (you can set
multiple variables). And the back-ticks (`) means that it's a command
to execute, so TM_DATE is set to the result of running date +%Y-%m-%d.
All this is of course related to bash and not really TextMate.
Another neat one is the full user name which we can get with niutil,
here's an example:
command = "[ -f $TM_NEW_FILE ] || TM_DATE=`date +%Y-%m-%d`
TM_USERNAME=`niutil -readprop / /users/\\$USER realname` perl -pe
's/\\$\\{([^}]*)\\}/$ENV{$1}/g' <index.html >\"$TM_NEW_FILE\"";
One important note: the commands above are prefixed with '[ -f
$TM_NEW_FILE ] || '. This is to check if the file already exists, and
if so, it won't do the "or" branch (i.e. overwrite it).
I really should have added this to the default templates! I'll be
adding it to all templates shipping with 1.0.1 -- if you create your
own templates, please add it to avoid templates from overwriting files!
The reason TextMate doesn't perform this check is, that the template
could generate multiple files, or not generate TM_NEW_FILE at al.
Also, remember that you're not limited to using perl as command. You
can write your templates in e.g. PHP and use php as the command to
generate them.
Kind regards Allan
On Oct 9, 2004, at 8:25 PM, Alan wrote:
> So what should escape do? And which dialog box are you talking about?
I'd like the escape key to map to the cancel button. Referring here to
the save dialog box; excape/cancel in the open box works fine. :)
Hi there
I'd love to see Textmate notify me if I attempt to set a keybinding
that the application is already using.
At present, I can enter the same keybinding twice (or more) without
any notification. BBEdit alerts you if you attempt to do this and it
is quite helpful.
I'm guessing that if you do enter a shortcut that has already been
taken, TextMate fails to then display it in the corresponding menu?
bongoman
Hi there
Am wanting to create a macro or snippet to allow me to comment out a
selection thus:
/* commented selection */
But am a little unclear if this is via a macro or a snippet. Either
way, I'm having trouble seting this up.
Any clues appreciated...
bongoman
I like that there's a per-file header added when you drop a bunch of
files into a new txt doc.
Where would I go to change the appearance and content of that header?
tx,
mm
--
Merlin Mann
43Folders.com
Hello,
I've setup a wiki[1] to collect various TextMate add-ons. The general
layout is still under construction, but feel free to modify anything.
This is obviously temporary solution until macromates configure their
own repository. I'll make sure that useful content gets transfered
later on. Also the wiki is not intended to replace Ian Phillips bundle
page[2], but rather to complement it.
I took a liberty of using TextMate icon. Please tell me if that's not
ok, and I'll remove it.
[1] http://glyf.org/TextMate/
[2] http://ianp.org/articles/textmate.html
---
Philipf
I quickly created an alternate icon that is distinctive in the dock and
says a little bit about what the application does. (It's not brilliant,
but I think it's functionally a little better). The icon may be used
freely for non-commercial purposes.
Alternate Textmate icon
http://www.spahr.org/share/textmate_icon.zip
Updated Smarty Syntax (same URL as previous version)
http://www.spahr.org/share/PHP_Smarty.tmbundle.zip
James.
I like that there's a per-file header added when you drop a bunch of
files into a new txt doc.
Where would I go to change the appearance and content of that header?
tx,
mm
--
Merlin Mann
43Folders.com
Hi all,
There were a couple of bugs in the Snippets, Commands, Macros and
Languages bundled with 1.0 (What can I say, I was in a rush!).
I'd like to use this thread to document any problems you've encountered
or suggestions you have specifically in regards to the Bundles.
Please, no feature requests, or anything related to the general TM
application.
Here's what I have so far:
Snippets:
- br and hr snippets are redundant (use "Make HTML Tag 2" command
instead)
- meta snippet didn't have any placeholders
- PHP function snippet didn't have a placeholder for the function name
- The three PHP tag openers are a little much... will make one
redundant, and people can customise top suit their own preferences
Languages:
- swapped SCRIPT and STYLE patterns around the wrong way in HTML.plist
Macros:
- nothing yet
Commands:
- rename "Reload in Safari" to "Refresh Safari", since that's all it
does
- add a php.net manual look-up command for the current word
I'd appreciate any suggestions for more snippets, macros and commands
to add to the default set. Please keep them all in this thread, so
it's easy for me to keep track of what's going on. Anything that can
help people speed up their productivity or solve repetitive or boring
tasks is a great candidate.
Justin French