使用 Sublime text 2 在块上添加 # 条评论

Add # comments on block with Sublime text 2

我想知道使用 sublime 在块上添加 # 评论的步骤。

基本上是从这样的代码开始的

console.log "code here"
console.log "code there"

应用快捷方式,然后获取这样的代码

# console.log "code here"
# console.log "code there"

现在我只能用多光标Ctrl+D删除它们。

传统的Ctrl+/或者Ctrl+Shift+/ 不起作用,因为它提供了这样的评论:

//console.log "code here"
//console.log "code there"

CTRL+/ for line comment

CTRL+Shift+/ for 块评论

您可以创建一个宏

[
    {"command": "split_selection_into_lines"},
    {"command": "move_to", "args": {"to": "bol", "extend": false}},
    {"command": "insert", "args": {"characters": "# "}}
]

然后是键盘映射:

{ "keys": ["ctrl+shift+i"], "command": "run_macro_file", "args": { "file": "Packages/User/Snippets/test_snippets/tmp_comment.sublime-macro" } }