In Sublime Text 2 it was possible to comment out a line or a block of lines with Ctrl+/ and Ctrl+Shift+/. According t
This worked just fine for me on Win 10:
[{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }
]
note that "[ ]" are nesassary and it will give you an error if you miss them.
On OSX Yosemite, I fixed this by going System Preferences
, Keyboard
, then Shortcuts
. Under App Shortcuts
, disable Show Help menu
which was bound to CMD+SHIFT+7.
My keyboard layout is Norwegian, with English as the OS language.
In my notebook keyboard, a ABNT 2, I can use the CTRL+; shortcut as the default comment action for blocks and lines. The same shortcut to uncomment.
On my mac the shortcut is ⌘cmd + / which makes multi line comment but as single lines:
// if ($username && $password) {
// echo "You are good to go";
// } else {
// echo "Fields cannot be blank";
// }
OR
⌥ alt + ⌘cmd + / and it's result is overall comment, from beggining of the selection to the end.
/*
if ($username && $password) {
echo "You are good to go";
} else {
echo "Fields cannot be blank";
}
*/
Use Ctrl + / for single line comment and
Ctrl + Alt + / for block or multiline comments.
It seems a bug: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=11157&start=0
As a workaround, go to Preferences
->Key Bindings - User
and add these keybindings (if you're using Linux):
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }
Update: This also works on Windows 8 (see @Sosi's comment)