[TxMt] Comment block

Allan Odgaard throw-away-1 at macromates.com
Tue Oct 18 16:32:00 UTC 2005


On 18/10/2005, at 17.18, Ruben Debeerst wrote:

> Where can I change the way that the comment-command cmd-/ is  
> working for a certain language?

Open the Bundle Editor, select the language in question (or make a  
custom bundle for your custom stuff, recommended), then from the +  
button choose New Preferences Item.

Set the scope for this new item to that of your language (e.g.  
source.java), and change it so that it looks like this:

/* preferences */
{   shellVariables = (
         {   name = 'TM_COMMENT_START';
             value = '# ';
         },
         {   name = 'TM_COMMENT_END';
             value = '';
         },
         {   name = 'TM_COMMENT_MODE';
             value = 'line';
         },
     );
}

For an example, see e.g. Python -> Miscellaneous.

Of course, if comment characters are already set for your language,  
you'd want to edit these rather than make new ones (but most  
languages just inherit the generic characters set in the Source  
bundle for the “source” scope).

The TM_COMMENT_MODE can be either block or line, and selects whether  
comment work line-by-line or around the selection.

The actual Toggle Comment command is a Ruby script in the Source  
bundle which just reads these variables (which are scope-sensitive,  
thus it should adapt properly).




More information about the textmate mailing list