Home Download Buy Blog Forum Support

Can I prevent indentation for toggle comment?

Can I prevent indentation for toggle comment?

Postby mar10 on Sat Oct 19, 2013 9:45 am

Hi,

I prefer line comments to start at column 0 instead of current block indentation, if they are used to comment out some unused code.
This is the main use case for me to use the Toggle Comment feature.

(I do indent informational comments, but hardly ever need the Toggle Comment feature there.)

So for example

Code: Select all

function foo() {
    var a = 1,
//         b = 2,
         c = 3;

//    alert("Called foo");
    [...]
}

function bar() {
    // I do indent informational comments though
}


Currently I get this instead:
Code: Select all
function foo() {
    var a = 1,
         // b = 2,
         c = 3;

    // alert("Called foo");
    [...]
}


Is this configurable?

Martin
mar10
 
Posts: 2
Joined: Fri Oct 18, 2013 8:55 pm

Re: Can I prevent indentation for toggle comment?

Postby frou on Sat Oct 19, 2013 8:03 pm

I think this can only be done per-language and that's by editing the "Comments.tmPreferences" file of that language package.

Just as TM_COMMENT_START is defined to be "//", you can define TM_COMMENT_DISABLE_INDENT to be "yes".
frou
 
Posts: 48
Joined: Sun Jul 31, 2011 11:26 am

Re: Can I prevent indentation for toggle comment?

Postby mar10 on Wed Oct 30, 2013 7:04 pm

Thanks for your answer and sorry for the late response.

Does that mean that I have to unzip the language file, then edit the included XML file, zip it again, and replace the original file?
mar10
 
Posts: 2
Joined: Fri Oct 18, 2013 8:55 pm

Re: Can I prevent indentation for toggle comment?

Postby sapphirehamster on Fri Nov 01, 2013 6:30 am

An alternative, if you're comfortable with writing plugins or working with Python: Copy comment.py from the Default package into your User directory, change it to not indent, give the command a different name (like ToggleComment2) and override the keybinding to use your new plugin.
sapphirehamster
 
Posts: 83
Joined: Sun Jul 01, 2012 11:19 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 16 guests