Keyboard shortcut to comment lines in Sublime Text

2019-01-12 16:15发布

In Sublime Text 2, how do I enclose a selection in a comment?
Is there a keyboard shortcut for this action?

15条回答
叛逆
2楼-- · 2019-01-12 16:47

In keyboard (Spanish), SO: Win7.

Go into Preferences->Key Bindings - Default, replace..."ctrl+/"]... by "ctrl+7"...

And don't use the numpad, it doesn't work. Just use the numbers above the letters

查看更多
混吃等死
3楼-- · 2019-01-12 16:48

First Open The Sublime Text 2.

And top menu bar on select the Preferences.

And than select the Key Bindings -User.

And than put this code,

[
    { "keys": ["ctrl+shift+c"], "command": "toggle_comment", "args": { "block": false } },

    { "keys": ["ctrl+shift+c"], "command": "toggle_comment", "args": { "block": true } }
]

I use Ctrl+Shift+C, You also different short cut key use.

查看更多
神经病院院长
4楼-- · 2019-01-12 16:50

In my keyboard (Swedish) it´s the key to the right of "ä": "*".

ctrl+*

查看更多
不美不萌又怎样
5楼-- · 2019-01-12 16:53

In a Brazilian Portuguese ABNT2 keyboard I have a similar issue to the one reported by JoshDM. In the file sublime-keymap I have:

{ "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } },

But I have to use ctrl+; and ctrl+shift+;. On my keyboard, ; is on the left of /.

It seems like a bug.

查看更多
啃猪蹄的小仙女
6楼-- · 2019-01-12 16:53

you need to replace "/" with "7", it works on non english keyboard layout.

查看更多
姐就是有狂的资本
7楼-- · 2019-01-12 16:55

On my laptop with spanish keyboard, the problem seems to be the "/" on the key binding, I changed it to ctrl+shift+c and now it works.

{ "keys": ["ctrl+shift+c"], "command": "toggle_comment", "args": { "block": true } },
查看更多
登录 后发表回答