Sublime Forum

Keymap and keyboard layout

#1

Hi,

Today I added shortcuts to ease typing curly quotes and it worked, kind of. The shortcut is Alt+[ but sublime is targeting what would be the [ key on an english keyboard.

I’m using an Brazilian Portuguese ABNT2 keyboard and the equivalent keys for [ and ] of an english keyboard are ´ and [, so I found the keys and they are working but how can I target the right key without worrying about the keyboard layout?

Thanks

0 Likes

#2

You can use sublime.log_input(True) in an open console to find out what Sublime Text sees in your key presses.

0 Likes

#3

Thanks FichteFoll

key evt: alt+[ when I press the ´
key evt: alt+] when I press the [

On my keyboard. Sublime is targeting scan codes instead of virtual keys. Is there any special code to target virtual keys instead? Targeting virtual keys will make the bindings work on any layout.

0 Likes

#4

You can not change st’s key mapping behavior. However, you can just set the binding to what detects as the scan code, i. e. Alt+[ or].

0 Likes