Cannot create key bindings with the pipe-key on my Norwegian keyboard in Sublime Text 2

2

I am trying to bind ctrl+| to Show Console in Sublime Text 2 on a Norwegian keyboard using the following line in the (json?) configuration file:

{ "keys": ["ctrl+|"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },

This doesn't work, and the pipe symbol also has a slightly darker tint than the rest of the configuration text, as if it is special.

I tried to escape it using "ctrl+\|" and "ctrl+\\|" none of which work. Binding it to something else like "ctrl+p" works fine.

Any idea of how to bind functionality with the pipe-key? It's the top left key on the keyboard, left to the 1 key.

André Christoffer Andersen

Posted 2014-07-11T12:12:59.640

Reputation: 287

Answers

2

I asked the question over at the sublime text forum. The user mlf gave me the answer which lead me to the solution:

Manually open the console: View -> Show Console

Enter sublime.log_input(True) then hit the key combination ctrl+|.

This produces the output chr evt: FS (0x1c). Here FS stands in for the File Separator character. You can produce it using alt+028 on the numpad in Windows.

Enter/past it into key bindings config file. It should look like the following:

{ "keys": ["FS"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },

Note that you cannot simply copy-paste the above line, you have to actually paste/produce the FS character yourself.

When done you can turn logging of with the command sublime.log_input(False) in the console.

André Christoffer Andersen

Posted 2014-07-11T12:12:59.640

Reputation: 287

To add more clarity for people with Nordic keyboards, the File Separator character is protected in Sublime Text, which means you need to escape it with another File Separator.

So to use ctrl + "Key next to 1" on your Nordic keyboard you use:

{ "keys": ["ctrl+\\"], "command": "show_panel", "args": {"panel": "console", "toggle": true} } – kristang – 2017-05-16T11:28:37.643

1

Answer is similar as André except that it didn't show the same "FS" character. For me it is showing "<0x1c>", which I thought was a simple string at the beginning but is actually the representation of the ASCII code.

When doing sublime.log_input(True) in the console, it shows chr evt: <0x1c> (0x1c) when I type ctrl + |. I just had to copy this <0x1c> ASCII code from the console (not a string), and paste it to my keybindings config file :

{ "keys": ["*<0x1c>*"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },

Kalaeman

Posted 2014-07-11T12:12:59.640

Reputation: 11

0

Unfortunately, the pipe symbol | is not one of Sublime's bindable keys, even on a US keyboard.

MattDMo

Posted 2014-07-11T12:12:59.640

Reputation: 4 968

If this is the case, and there are no workarounds, then this is a bug. Because letting me bind the so called "tilde" key to functionality is expected functionality from a $70 software. – André Christoffer Andersen – 2014-07-14T10:41:56.583