Sublime Forum

Where do you define comment character for a language?

#1

In SublimeText when working with a YAML (*.yml) file, commenting a line uses the double frontslash (//) as the comment. This is not the correct syntax. The correct character is a # . See here yaml.org/spec/current.html#id2520528

I was looking through the Data/Packages trying to figure out where to change this but I couldn’t find it. I figured it was in the yaml.tmLanguage but I couldn’t track down the right place. Where do I change this?

3 Likes

#2

You use .tmPreferences files. This is the one for Lua:

<?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.lua</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>8A2A2BE0-B474-49B4-85C3-BAF2BD2FCAFB</string>
</dict>
</plist>
1 Like