[TxMt] Help with macro for comments
Guido Governatori
guido at itee.uq.edu.au
Sat Nov 3 00:58:26 UTC 2007
Create a language (Chapter 10 of the TextMate Book and Section 12 of
the online help) with something like
{ scopeName = 'source.yourlanguage';
fileTypes = ( '.yourextension' );
patterns = (
{ name = 'comment.language.yourlanguage';
begin = '/\*';
end = '\*/';
},
);
}
Then create a comment snippet (Chapter 6)
/*
------------------------------
| Constructor $0
------------------------------
*/
activated by Tab Trigeer comment ->
then create a second snnippet
"
| $0
"
activated by the key equivalent "return"
It might be possible to use a different approach based on a sigle
snippet and transformation, but it could be tricky to write the
regular expressions your need.
Hope this helps
Guido
On 03/11/2007, at 9:32 AM, Steve Finkelstein wrote:
> Hmm, I'd be interested in further researching this. Is there a
> reference in the TextMate book or website that I can refer to for
> further details? I bought the Pragmatic edition of the TextMate book.
>
> - sf
>
> On 11/2/07, Guido Governatori <guido at itee.uq.edu.au> wrote:
>> What about defining a language (scope) for your comments and then a
>> snippet triggered by return in the scope defined by the comment.
>>
>> All the best
>>
>> Guido
>> On 03/11/2007, at 8:13 AM, Steve Finkelstein wrote:
>>
>>> Hi all,
>>>
>>> I'm looking to add a macro that will let me do something like
>>>
>>> comment ->
>>>
>>> and create an inline comment structure like:
>>>
>>> /*
>>>
>>> +-------------------------------------------------------------------
>>> --
>>> -----
>>> | Constructor
>>>
>>> +-------------------------------------------------------------------
>>> --
>>> -----
>>> */
>>>
>>> The only trick is, is it possible to continue pre-pending
>>> additional |
>>> everytime I hit a newline? so if my comment consists of more than
>>> one
>>> line I can do
>>>
>>> comment ->
>>>
>>> /*
>>>
>>> +-------------------------------------------------------------------
>>> --
>>> -----
>>> | Constructor
>>> | <-- added by macro
>>> | <-- also added... etc
>>>
>>> +-------------------------------------------------------------------
>>> --
>>> -----
>>> */
>>>
>>> Cheers!
>>>
>>> - sf
>>>
>>> ____________________________________________________________________
>>> __
>>> For new threads USE THIS: textmate at lists.macromates.com
>>> (threading gets destroyed and the universe will collapse if you
>>> don't)
>>> http://lists.macromates.com/mailman/listinfo/textmate
>>
>> --
>> Dr Guido Governatori
>> School of Information Technology and Electrical Engineering
>> The University of Queensland
>> Brisbane, Queensland, 4072, Australia
>> Phone: +61-(0)7-336 52907
>> Fax: +61-(0)7-336 54999
>> http://www.governatori.net/TextMate
>> http://www.defeasible.org
>>
>>
>>
>> _____________________________________________________________________
>> _
>> For new threads USE THIS: textmate at lists.macromates.com
>> (threading gets destroyed and the universe will collapse if you
>> don't)
>> http://lists.macromates.com/mailman/listinfo/textmate
>>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
--
Dr Guido Governatori
School of Information Technology and Electrical Engineering
The University of Queensland
Brisbane, Queensland, 4072, Australia
Phone: +61-(0)7-336 52907
Fax: +61-(0)7-336 54999
http://www.governatori.net/TextMate
http://www.defeasible.org
More information about the textmate
mailing list