6

I'm running Sublime Text 2 on Windows x64 with the following packages installed:

  • Package Control
  • CoffeeScript
  • EncodingHelper
  • GIT
  • MarkDown Preview
  • Python PEP8 Lint
  • Stylus
  • SFTP
  • Theme - Soda

I had installed all these packages before I started coding and noticed that the open square bracket ([) can't be written in the editor. On my Norwegian keyboard that's ALTGR+8. I have all these packages (Except the Soda theme) on all my other development machines as well, but they are all Ubuntu machines.

I'm wondering how I can figure out what the problem is. I'm assuming that some key bind has overwritten ALTGR+8 but nothing happens when I use it. Is there a verbose- or debug mode I can use to figure out what's going on? Alternatively, is there perhaps a hack I can deploy to set the ALTGR+8 key-bind to write the open square symbol?

Thanks

6

I had this issue too, and couldn't write [, ] and }, but with different packages. I'm using Danish keyboard layout, so AltGr+8, AltGr+9 and AltGr+0 were the troubling keys for me.

My solution was to use Find in files to search for the keybinding files in all packages for the corresponding keybindings that was overriding my default keybindings to write brackets.

Preferences -> Browse packages copy the path, return to SublimeText and press Ctrl + Shift + F to search in files, and paste the path in the Where field. In my case, I needed to search for alt+ctrl+8, alt+ctrl+9 and alt+ctrl+0 and uncomment the lines which had the corresponding keybindings - if you still need to use the shortcuts, you can change them to another combination.

Works flawlessly. :)

3

If like me you couldn't find any suspicious key binding (ctrl+alt+= for } on french keyboard), you can force it in the Preferences > Key bindings -- USER file.

[
    { "keys": ["ctrl+alt+="], "command": "insert", "args": {"characters": "}"} }
]
3

Same here at a German Keyboard Layout with QWERTZ.

Solution:

Preferences > Key Bindings - User

Add those:

{ "keys": ["ctrl+alt+0"], "command": "insert", "args": {"characters": "}"} },
{ "keys": ["ctrl+alt+8"], "command": "insert", "args": {"characters": "["} },
{ "keys": ["ctrl+alt+9"], "command": "insert", "args": {"characters": "]"} },
2

I searched in

C:\Users*********\AppData\Roaming\Sublime Text 3

for alt+ctrl+8 and alt+ctrl+9

And commented out the 2 corresponding lines. There were in total 4 lines in which these combination was used.

0

Ok I actually figured that out quite quickly after asking the question. After a bit more of ALTGR+8 spamming in various situations I noticed that it produced a quick panel with the text "W391: empty line at the end of file" which obviously pointed to the PyLint package. Disabling it fixed my issue, so I'll rebind it to something a bit less destructive to my workflow.

I'd still like to know how to figure this sort of issue out (without luckily stumbling upon the solution) though, so I won't accept this answer.

0

You can open the console (Ctrl+` or View > Show Console) to see if there's an error message from any of the packages.

Besides, you can execute sublime.log_commands(True) in the console to know what command is being called, in case the error does not allow you to find out.

0

I encountered this problem too after installing the MarkdownEditing plugin, which overrode all the [Alt+Ctrl+'digit'] commands in their latest version.

Note to developers: These type of key-bindings are more of an inconvenience than a feature especially for the french keyboard users so please avoid them.

This is what I had to do to get it working again:

Preferences -> Key Bindings, then in the user file add these lines (These are valid for the french keyboard):

    { "keys": ["ctrl+alt+0"], "command": "insert", "args": {"characters": "@"}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]},
    { "keys": ["ctrl+alt+2"], "command": "insert", "args": {"characters": "~"}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]},
    { "keys": ["ctrl+alt+3"], "command": "insert", "args": {"characters": "#"}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]},
    { "keys": ["ctrl+alt+4"], "command": "insert", "args": {"characters": "{"}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]},
    { "keys": ["ctrl+alt+5"], "command": "insert", "args": {"characters": "["}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]},
    { "keys": ["ctrl+alt+6"], "command": "insert", "args": {"characters": "|"}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]},
    { "keys": ["ctrl+alt+7"], "command": "insert", "args": {"characters": "`"}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]},
    { "keys": ["ctrl+alt+8"], "command": "insert", "args": {"characters": "\\"}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]},
    { "keys": ["ctrl+alt+9"], "command": "insert", "args": {"characters": "^"}, "context": [{"key": "selector", "operator": "equal",  "operand": "text.html.md,text.html.markdown"}]}

Note that this will make you lose the autocomplete features related to these characters (such as auto-closing bracket), so I made sure to a override them in the context of *.md and *.markdown file extensions only, If you don't define the context you will lose the autocomplete features in all file extensions and this is probably an unwanted thing.

New contributor
Yassir Khaldi is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.