如何修改Sublime Text 3默认注释符号?SQL文件注释替换为#
Hey there! Let's walk through your two Sublime Text 3 questions step by step—super straightforward once you know where to look.
1. How to modify default comment symbols in Sublime Text 3
The core idea here is targeting the syntax-specific configuration for the language you're working with. Every language in Sublime has its own settings that define things like comment markers. Here's the general workflow:
- Open a file of the target language (like your .sql file for the second question)
- Go to
Preferences > Settings - Syntax Specific—this opens the dedicated settings file for that language - In the right-hand pane (your custom user settings), add or modify the comment-related keys. The most common ones are:
line_comment: The string used for single-line commentsblock_comment: A list defining the start and end of block comments (e.g.,["/*", "*/"]for SQL)
2. Changing SQL single-line comment from
-- note here to #notes here For your .sql file scenario, here's exactly what to do:
- Open any .sql file in Sublime Text 3
- Navigate to
Preferences > Settings - Syntax Specific—this will openSQL.sublime-settings(User) - Paste the following valid JSON configuration into the file:
{ "line_comment": "#notes here ", // Optional: Keep default block comments or adjust them here "block_comment": ["/*", "*/"] }
- Save the file, then close and reopen your .sql file to apply the changes
- Now when you hit
Ctrl + /, it'll automatically insert#notes hereat the start of the line, with your cursor ready to add more text.
If you just want the # marker without the default "notes here" text, you can set "line_comment": "#" instead—Sublime will place your cursor right after the # for you to type your note.
内容的提问来源于stack exchange,提问作者kittygirl
相关产品推荐
相关产品推荐

