Sublime Forum

Toggle comment not working on Windows for me



I’m having this trouble with sublimetext 2. Same shortcut is used with IntelliJ IDEA, but I’m not running it right now, so I don’t know if the problem is in overlapping or … how can I be sure?




No, it doesn’t work even on computer without IntelliJ IDEA. Sucks :frowning:

So, again, I’, using 32 bit build of 2165 on (Windows 7 32 and 64 bit tested).



It works for me on both Win 7 and Vista.

What type of file are you in? Commenting works differently for different file types. For example it doesn’t do anything on text files. In a JSON file (like a preferences file) it gives a line comment for ctrl+/, and a block comment for ctrl+shift+/. What are you trying to do?

I can’t imagine it would have anything to do with IntelliJ IDEA just because it uses the same keypress. But it may be affected if you have Ctrl+/ assigned to something in AutoHotKey or the like.



It’s not IDEA problem, I’ve checked. I’m testing on commenting html and ruby code. If I go through menu: Edit > Comment > Toggle Comment … than it works, but not with key shortcut. Also all other shortcuts works … like ctrl + p or ctrl + shift + p and so on…



I was able to get toggle_comment to work on both html and ruby file types. Since you say it works from the menu, it suggests that there are some changes in your key bindings.

You could define your own shortcut to it to test that it works. Open “Key Bindings - User” from the Preferences menu and add this:

    { "keys": "ctrl+\\"], "command": "toggle_comment", "args": { "block": false } }

Put it between the square brackets if the file is new, or Include a comma before or after if you already have other entries.

Note that I used control + Backslash, which is unlikely to have anything bound to it. You have to escape the backslash with itself.

If this works to comment a line and Ctrl + Forward Slash doesn’t, it means something else in your Sublime config or your system is using that keystroke.

Another way to test is to try it with an unmodified portable install, or use the revert process from



Thanks for help!

I’ve defined new keymap in Key Bindings - User. It didn’t work with ctrl+\ so I tried ctrl+q for test. It works. It works with alphanumeric characters.
ctrl+/ is defined only at one place in Key Bindings - Default…so I don’t really get what is the problem.

I tried with portable install before too, no luck with ctrl+/.



Sometimes plugins override default key bindings.



For me on Windows 7 64, the keybindings for non numeric or character char. is not the actual char. printed on the key, but the position of the key (keycode ?).
So the key for the comment (’/’) is the first key on the first row, right before the 1 key (for me ‘§’).
Working like this make sense cos actually the ‘/’ key is a second choice char. on my keyboard, so I couldn’t trigger ctrl+/ without adding shift key.
But I don’t know why it’s this key ??? (maybe Jon could help ?)

Try it.



Finally it works for me. I needed to use this tool to help me out. If anyone has also this problem just rebind your key like this




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


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



This post was flagged by the community and is temporarily hidden.