Sublime Forum

How to debug keybinds?

#1

I’m using the sublemacspro package and getting strange behavior. The keybind to move ahead one word, alt+f, is performing two operations - moving ahead by a word AND opening the “File” menu. Any suggestions on how I can debug this problem? Thanks.

—Jason

0 Likes

#2

alt+Mnemonic is built in OS behavior that likely can’t be disabled.

You should pick a different key combination than alt+f - ideally never use a plain alt+letter, but add another modifier key.

0 Likes

#3

Hi, Keith,

Thanks for getting back to me. I’ve been living my life in Linux for the past 6+ years and I’m back to Windows due to a job change.

However, I left out an important clue - the behavior is intermittent. Generally, after starting Sublime, the keybinds will work as expected, including all of the alt+ keybinds (emacs lives in alt+ land - alt+a, alt+e, alt+f, alt+d, alt+x, etc.). It’s only some time after doing normal editing, Sublime “forgets” the sublemacspro keybinds or does this odd multi-command behavior.

Any other sublemacspro user having trouble in Windows?

Should plugins do something to explicitly inhibit the chain of keybinds from continuing, like handling GUI events?

Is there a way for me to force the keybind settings to be reloaded? I’m very green with Sublime, having used it for the first time a week ago.

Thanks again for the suggestion!

—Jason

0 Likes

#4

I’ve just had a quick play with it, and it seems that the keybindings do indeed override/prevent the default menu mnemonic behavior by default, without any extra actions required to suppress the default GUI behavior. So I’m not sure how it is possible to end up with the keybinding action and the open menu action.

Thinking about what could be happening in your case, maybe this “sublemacspro” package defines the keybindings with a context that is somehow considered no longer active in certain circumstances? From what I can see, it is based on a setting called sbp_use_alt_bindings. So unless that setting is somehow being changed, I don’t know what is going on.

If you open the Sublime Text Console (View menu -> Show Console) and type:

sublime.log_commands(True)
sublime.log_input(True)

Then you will see in the console what keypresses ST recognizes and what commands it is executing. Maybe that will somehow help to debug the problem.

1 Like

#5

Hi, Keith!

That’s fabulous news. Thank you for taking your time to investigate this further for me. I expect to be writing plugins and macros myself in the future, but I really appreciate your helpful nudge in the right direction. I’ll definitely look into it.

Interesting that you mention context. I’ve noticed that the keybinds get wonky when the nagscreen comes up. The nagscreen, even though it’s not modal, seems to have an effect of keybinds that I don’t understand. It would make sense that some context is changing.

I’ve also noticed that the odd keybind behavior most often asserts itself after switching away from and then coming back to the Sublime window, which would also validate your guess of “context.” I’ll try my hand at diving deeper.

Thanks again!

—Jason

1 Like