Keyboard shortcut to comment lines in Sublime Text 2

In the "Preferences->Key Bindings - User"

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

Just paste it, these are will work great !


For German keyboards use ctrl+shift+# to toggle a block comment and ctrl+# to toggle a line comment.

The shortcut in Preferences->Key Bindings - Default is set to Ctrl+Shift+/ and Ctrl+/, but to actually use the functions, press the keys stated above.


I'd like to add, that on my mac by default block comment toggle shortcut is cmd+alt+/


By default on Linux/Windows for an English keyboard the shortcut is Ctrl+Shift+/ to toggle a block comment, and Ctrl+/ to toggle a line comment.

If you go into Preferences->Key Bindings - Default, you can find all the shortcuts, below are the lines for commenting.

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

Tags:

Sublimetext2