Reputation: 4119
In Sublime Text 2 and a file with "Ruby Haml" syntax, adding Haml comments using the keybinding work fine for haml lines. However, for an embedded ruby line (a line that starts with -
or =
), the comments don't work correctly. If the cursor is on either end, it's fine. But if the cursor is in the middle of the line, Sublime adds a ruby comment (#
).
I tried the package listed in this answer: How do i get HAML comments to work correctly in Sublime text 2, https://github.com/phuibonhoa/handcrafted-haml-textmate-bundle. It did not fix it for me.
I also saw this thread: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=7346, but it's not exactly what I want.
Upvotes: 2
Views: 1131
Reputation: 4119
Here is my fix: I copied "Ruby Haml Comments.tmPreferences", found in Packages/Rails. I renamed the file "Ruby Haml Embedded Comments.tmPreferences" I then edited the scope so that the haml comments will work for embedded ruby.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//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.ruby.embedded.haml</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>
</dict>
</plist>
You can change /
to -#
if you prefer that syntax.
Update
Sublime Text 3: packages are 7zipped and renamed PackageName.sublime-package. You can find the installed packages in your Installed Packages
directory (up one level from your Packages
folder). Find the Haml.sublime-package archive, open with 7zip or similar and you will see the Comments.tmPreferences file in the Preferences folder.
However, you don't need to re package plugins in order to use them. Simply add them to your Packages
folder like you would for ST2 (Packages/User
for config files).
Go here for more info on packages: http://sublime-text-unofficial-documentation.readthedocs.org/en/latest/reference/plugins.html#plugins
Upvotes: 3