[TxMt] Please help with Project title $TM_ variable
Web Revolution
webrevol at gmail.com
Thu Jan 25 18:41:15 UTC 2007
> If this is a snippet, you would do:
> ${TM_PROJECT_FILEPATH/\.[^.]*$//}
Dear Haris,
thank you for your reply. The code above works only if a new snippet is
created and it is not my case as I would like to have the project name in
the new template file instead.
> Otherwise you need to provide us with more of an example of your
> situation.
I will try to explain myself better.
Within the 'Bundles Editor' I create a new 'Template' and a new 'Template
File'.
In the 'Template' 'Command(s)' editor I have:
if [[ ! -f "$TM_NEW_FILE" ]]; then
TM_YEAR=`date +%Y` \
TM_DATE=`date +%d" "%b" "%Y" "@" "%I:%M" "%p" "%z` \
TM_USERNAME=`niutil -readprop / /users/\$USER realname` \
perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \
< testfile.html > "$TM_NEW_FILE"
fi
and in the 'Template File' editor I have:
<!-- ${TM_PROJECT_FILEPATH} - ${TM_DATE} -->
Next... I do create a new Textmate project and I save it to desktop as
'testfile' and create a new template, selecting the new template I just
created above.
The output for the new created template is:
/Users/webrevol/Desktop/testfile.tmproj
..but what I would like to get is only the project filename:
testfile (or testfile.tmproj)
As you see I would like to get the textmate project name on my new created
file without the Path and if possible, without the filename extension.
Again, thanks for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070125/0f0a4e49/attachment.html>
More information about the textmate
mailing list