Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable Groovy comments in SublimeText 3 on a Mac?

Currently i am using SublimeText 3 on a Mac but i am unable to 'comment' existing Groovy code. The menu and the shortcut keys do not place the actual '//' comments when i use the menu or the shortcut key. I have searched but i only found solutions to correct this in SublimeText 2. These solutions to copy some Java comments do not work.

Any solution on how Groovy comments can be enabled in SublimeText 3?

like image 361
Marco Avatar asked Jul 04 '14 05:07

Marco


1 Answers

These instructions are for OS X, but the same general method applies to any platform.

Go to Sublime Text -> Preferences -> Browse Packages... to open up the Packages folder (~/Library/Application Support/Sublime Text 3/Packages). Create a new folder in Packages named Groovy. Next, create a new file in Sublime with XML syntax and the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Comments</string>
    <key>scope</key>
    <string>source.groovy</string>
    <key>settings</key>
    <dict>
        <key>shellVariables</key>
        <array>
            <dict>
                <key>name</key>
                <string>TM_COMMENT_START</string>
                <key>value</key>
                <string>// </string>
            </dict>
        </array>
    </dict>
    <key>uuid</key>
    <string>D3A56263-A730-4C6E-B8F2-E65FEE21870B</string>
</dict>
</plist>

Save this file as Packages/Groovy/Comments.tmPreferences. You might get a warning about saving the file with a .xml suffix, just ignore it and use .tmPreferences.

And now you should be able to hit / and insert comments.

like image 135
MattDMo Avatar answered Sep 21 '22 05:09

MattDMo