Home Download Buy Blog Forum Support

Comment character at the beginning of the line

Comment character at the beginning of the line

Postby nemesis on Sun Apr 28, 2013 12:19 am

Is there a way to insert the comment character at the beginning of the line
instead of at the position where the text starts when using the shortcut keys
(shift + /) to comment lines?

For instance, I have a fuzzy code like this:
Code: Select all
AAAA
     BBBB
           CCCC
DDDD


And I automatically comment lines 2 and 3, the result is:
Code: Select all
AAAA
     # BBBB
     #      CCCC
DDDD


What I would like to get is:
Code: Select all
AAAA
#      BBBB
#            CCCC
DDDD


Not a big deal but it's something I was able to toggle in Geany editor
and I cannot find a way to configure in Sublime.

Thank you!
nemesis
 
Posts: 2
Joined: Thu Apr 25, 2013 10:45 am

Re: Comment character at the beginning of the line

Postby frou on Sun Apr 28, 2013 1:18 pm

This is a per-language thing that you can get by including the following in the "Comments.tmPreferences" file of that language package.

Code: Select all
<dict>
    <key>name</key>
    <string>TM_COMMENT_DISABLE_INDENT</string>
    <key>value</key>
    <string>yes</string>
</dict>
frou
 
Posts: 47
Joined: Sun Jul 31, 2011 11:26 am

Re: Comment character at the beginning of the line

Postby asomorjai on Fri Aug 16, 2013 6:49 pm

frou wrote:This is a per-language thing that you can get by including the following in the "Comments.tmPreferences" file of that language package.

Code: Select all
<dict>
    <key>name</key>
    <string>TM_COMMENT_DISABLE_INDENT</string>
    <key>value</key>
    <string>yes</string>
</dict>


How would you achieve this in ST3? I don't feel like modifying the inside of the application.

Thanks, Ákos
asomorjai
 
Posts: 10
Joined: Fri Apr 13, 2012 12:15 pm

Re: Comment character at the beginning of the line

Postby qgates on Sat Aug 17, 2013 4:56 pm

@asomorjai, sublime-package files are simply zipfiles with another extension. So,

1. Open the required language sublime-package file in your favourite zip program
2. extract the Comments.tmPreferences file somewhere into your User folder
3. Edit and save the file to make the desired changes to comment behaviour

If you take a look at Comments (C++).tmPreferences you can see how and where TM_COMMENT_DISABLE_INDENT should be used.

:)
qgates
 
Posts: 205
Joined: Mon Nov 05, 2012 4:33 pm


Return to General Discussion

Who is online

Users browsing this forum: Matichek and 67 guests