Sublime Forum

Key Bindings don't work

#1

Hi there! I use Sublime Text 2 on Mac OS X (German) and most of the key bindings don’t work. For example ›toggle comment‹ (cmd + shift + /) doesn’t work and changing to cmd + shift + 7 brings also no effect. Do somebody know this problem?

Thanks & Bye

Andre

0 Likes

#2

The keyboard layout probably doesn’t send the exact keys that the command is bound to. Open up the python console via menu item “View->Console” and type “sublime.log_input(True)” and you’ll see what keys sublime gets from the OS.

0 Likes

#3

Hi quarnster,
I’m having the same issue here, using a Brazilian ABNT keyboard.
I did what you told to do and the console shows the correct key (i.e. when I press /] it outputs **chr evt: / (0x2f) **]), however when I try to toggle_comments:

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

ST2 doesn’t respond. I need to press ctrl+; to work.
Which is obviously just a keymapping issue.

0 Likes

#4

Hello,

Actually I suffer from same thing now: toggle_comments doesn’t work.
I’m a Mac user, so toggle key is super(command key in mac)+forward_slash, not ctrl+/.
Anyway I checked with ***sublime.log_input(True)***, but it says correctly: super+/…

I checked menu -> Edit -> Comment and found out it is disabled. I’m not pretty sure that caused this symptom.

I’m really curious how I can solve this problem.
Any suggestion would be appreciated!

0 Likes

#5

aloescher: Comment togging only works for languages which define comment meta data, which isn’t all of them.

brucardoso2: When debugging with log_input(True), you need to press the exact same combination of keys, i.e., ctrl+/, rather than just /, as the OS will often deliver different input data to the application in these cases.

0 Likes

#6

Is there a simple way to install all the key bindings for a German keyboard?
best, j

0 Likes

#7

[quote=“jps”]aloescher: Comment togging only works for languages which define comment meta data, which isn’t all of them.

brucardoso2: When debugging with log_input(True), you need to press the exact same combination of keys, i.e., ctrl+/, rather than just /, as the OS will often deliver different input data to the application in these cases.[/quote]

Hi jps,
Pressing ctrl+/ the console outputs nothing. Pressing ctrl+; the console outputs:

key evt: control+/
0 Likes

#8

Hello @quarnster so I did exactly what you said… activated the input log, and found that ctrl+1 and ctrl+0 works but ctrl+2 or +3… does not do anything… now how can I fix this? Im using US keyboard mapping.

To make this stranger, control+shift+2…3…4 does work

0 Likes

#9

Hi to all. this solution works for me (toggle javascript comments)

windows 7 ultimate 32b.
spanish keyboard.

open the keybindings: preferences > key bindings default
then copy :

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

open the keygindings: preferences > key bindings user
paste and change it to this (without the last comma):

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

now i can toggle js single (ctrl+7) and multiline (ctrl+shift+7) comments.

hope this helps someone with the same problem.

0 Likes

#10

I have this problem too on Windows 7 64, with an ABNT 2 keyboard.
And the problem still persists.

Use ctrl+7 is not a solution for me.

0 Likes

#11

Same problem here with Italian keyboard, on Windows 7 64bit
“ctrl+/” does simply nothing, I have to type" ctrl+ù" to work (in the console, “ctrl+ù” is logged as “ctrl+/”)
Any workaround or, better, a fix?

0 Likes

#12

Replacing ctrl+/ and ctrl+shift+/ with ctrl+7 and ctrl+shift+7 worked for me on ST3 on Ubuntu.

0 Likes

#13

While ctrl is pressed, ; is read as /, just as if the keyboard language was set to us.

Seens that the problem is with language settings in sublime.

0 Likes

#14

You have to replace “/” with “keypad_divide”:

The content of my user key bindings:

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

That works for me at least.

0 Likes

#15

I am not sure how sublime identifies key presses, but there are times where sublime will identify key presses differently than the rest of the system. I know I run Windows 7 via Bootcamp on my Mac, and sublime gets a number of keys wrong; even when the rest of the system reads them correctly. So I think there is something unreliable about how sublime identifies key presses.

0 Likes

#16

I’m having this problem too, WIndows 7 64bits, Sublime Text 3.

0 Likes

#17

I believe this is a problem with Brazilan keyboards.

When i press “/” in normal keyboard, the console shows me:
chr evt: / (0x2f)

but when i press “/” in numerical keyboard, the console shows me:
chr evt: / (0x2f) key evt: keypad_divide

0 Likes