Sublime Forum

[solved] Binding command to 'enter' doesn't work anymore from a package?

#1

hello!

I get this really weird thing with ST: I can’t overwrite the key enter or backspace from a Default.sublime-keymap in a package. (except the User one).

This is really annoying because I made a plugin for markdown that managed the list numbers, and it updated the them when I pressed enter on the end of the line. So, now, nothing’s working…

I tried with a lot of context (checked that it was matching, still), or none, but it doesn’t change anything.

I’m using Vintage mode, but I’ve disabled it and restarted ST, but it doesn’t change anything…

Any hint?

Matt

0 Likes

#2

I can’t see why that shouldn’t work. Are you sure you used a platform in the filename? I assume you did but it’s the only thing I can think of that you didn’t already cover, since you mention Default.sublime-keymap and not e.g. Default (Windows).sublime-keymap or some such.

As a test, I threw bindings for the enter and backspace key into my ConfigPopup key bindings file for widows and it seemed to work just fine. In fact, it worked too fine so I had to reconfigure my example to apply only to a markdown context (just because you mentioned it). Turns out those keys are pretty vital to a lot of stuff. :wink:

For comparison purposes, the key bindings in the file are as follows:

{
    "keys": ["enter"],
    "command": "insert",
    "args": {"characters": "<-- Enter\n"},
    "context": [
        {
            "key": "selector",
            "operator": "equal",
            "operand": "text.html.markdown"
        }
    ]
},
{
    "keys": ["backspace"],
    "command": "insert",
    "args": {"characters": "<-- Nope\n"},
    "context": [
        {
            "key": "selector",
            "operator": "equal",
            "operand": "text.html.markdown"
        }
    ]
},
0 Likes

#3

I retried a bit more, and I get the it’s only in my fast-markdown package that the keybindings aren’t working… (moved it to a completely new folder, and it works). Gonna dig in a bit more.

EDIT: impressive. It doesn’t want fastmarkdown, fastMarkdown, fast-markdown, but slow-markdown's perfectly fine :smile: I tried removing the .sublime_session files, but it didn’t change anything.

Do you know what’s the Backup folder for?

0 Likes

#4

If it’s the one a directory level above the packages folder that’s filled with folders that are named for a date and time, they’re backups that PackageControl makes when it’s overwriting files.

1 Like

#5

Packages are loaded in lexical order (except Default is always first and User is always last). Possibly you have a package installed with a name that starts with something after ‘Fa’ and before ‘Sl’ that is overwriting your binding? Just a shot in the dark.

3 Likes

#6

https://packagecontrol.io/packages/FindKeyConflicts

2 Likes

#7

@OdatNurd Where did you learn to shoot? Right in the middle mate! It’s packagechecker (not on package control). And now I know! It’s because this package has the default shortcuts to compare against the tested package!

0 Likes

#8

Sweet, glad you got it sorted! :thumbsup:

Double bonus points to @kingkeith for FindKeyConflicts, too. I actually have that installed but forgot all about it.

0 Likes