创建一个包含以下内容的 XML 文件Packages/User
(Comments.tmPreferences
我假设您的语言的基本范围是source.jsx
- 您可以在.tmLanguage
文件中找到它):
<?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.jsx</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>// </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>{/* </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string> */}</string>
</dict>
</array>
</dict>
<key>uuid</key>
<string>F9BFFF1F-1999-4722-B094-52E8AFD234D1</string>
</dict>
</plist>
//
当您点击时将保持默认评论前缀⌘</kbd>/, but when you select some text and hit ⌘</kbd>Shift/ you will wrap it in {/* blahblahblah */}
.
如果您想完全摆脱//
,请改用以下内容:
<?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.jsx</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>{/* </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END</string>
<key>value</key>
<string> */}</string>
</dict>
</array>
</dict>
<key>uuid</key>
<string>F9BFFF1F-1999-4722-B094-52E8AFD234D1</string>
</dict>
</plist>