Sublime Forum

Thoughts on shortcuts/menus

#1

Firstly I’m not sure if this has been covered before, I’ve done some searching and cannot find anything that describes exactly my thoughts here… Please feel free to chime in, I’d love to hear what others think before I file a feature request. (Also if there is a way to accomplish what I’m talking about without a new feature, please let me know… but as it stands anything close I’ve found seems inconsistent)

I’m using Sublime Text 2 & if I install all the plugins I use frequently, that there is some overlap in shortcuts & inconsistency in menu/palate use for various plugins. This hasn’t really been a big issue, I can change shortcuts and add menu extensions in the user folder to make things a little easier when I’m tired, or I am constantly switching coding focuses.

My thoughts boil down to this: It would be nice to see a “display” of where shortcuts, menus, and palates are defined across the entire packages folder by iterating over the shortcuts/menus themselves… not the definitions. I would also like to see each definition establish a uid that is procedurally created from package>type>command>etc. That way overriding definitions could be created for one command, instead of two, in cases where two plugins have laid claim to a single shortcut.

For example, Plugin A & Plugin B both use the shortcut:

CTRL + SUPER + `

The “display page” could be something like this:

CTRL + SUPER + ` 1) Plugin A: "some_display_command", ID: ef17cb4275aa7472f230e91aa4971027 2) Plugin B: "some_format_command", ID: 5143982b75f7dc7a0f19901b50a94691

The “ID” in this case is the following string as an md5: “pkg_plugin_a_shortcut_some_display_command”. The order shows us which is loaded on top. Lets say I want Plugin B to have the shortcut and Plugin A to move… by using the “id of the definition” I could tell sublime to “move” Plugin A’s command in a single definition… allowing Plugin B to implicitly retake priority. Right now I have to make two definitions one moving Plugin A, the other re-establishing Plugin B.

Menus are another example of how re-defining things isn’t a perfect fix. I can make an entry in the menu I want… but I have to alter the plugin to remove the original (a change that will be lost on updating).

If by some chance there is a way to do this currently, or there is a different plan moving forward, I’d love to hear it. But so far anything I’ve tried has been inconsistent.

Best,
Matt

Edit: Wordiness

0 Likes

#2

EditPreferences does this quite nicely, imo. It only works on Sublime Text 3 however.

There is also packagecontrol.io/packages/FindKeyConflicts

I don’t get this. You only have to add the binding you want to have priority to your User package’s bindings, since that is loaded last.

Sublime Text 3 allows for a something called “override packages” (docs. It has the downside that you won’t receive updates for the overridden files however, for obvious reasons.

0 Likes

#3

Thanks for the reply, I guess I missed it way back when. Right now I’m using ST3 and my original issue is less bothersome. But I figure I’ll offer some more context in case theres a solution I’ve missed.

I was looking for something more than just placing new definitions in the User/Default (OSX)… There can be excessive arguments to a particular keybound command. A problem occurs when I have 2 plugins competing for a single keybind, and I want to use both for the keybinding at different times.

In the past my solution had been to create a master file of keybindings I needed for different workspaces and then religiously copy bindings into the relevant project file. The problem was that if a plugin updated and the args changed then I’d have to update dozens of projects. (Recently I’ve been using a different tactic, but the issue is bigger than rebinding complex definitions.)

In my suggestion what I was really talking about was turning keybind definitions (commands and args) into symbols; with each definition having an addressable id that would remain the same no matter how the definition changed. That way I could simply define which definition I wanted to use for a binding.

An implementation of this would be to add a field to the prototype keybind object called ‘name’ that would let plugin developers address their bindings. (Name would be namespaced under the name of the plugin itself) E.g.

{ "keys": ["super+alt+d"], "id": "emmet_keybind_rename_tag" } // --or-- { "id": "emmet_keybind_rename_tag" }

This idea could even be expanded further… Since my original post I have gotten deep into working with and building plugins. One thing I’ve noticed is that a particular “action” is VERY often a combination of command+args (rather than a unique command name) and is defined in several places: a keybind file… a command pallet file… a menu file. Etc.

Perhaps it would be helpful to make a new file with “actions” that can be addressed in each of the key files. Then later in the user preferences?

p.s. This forum layout has changed since the post was made… this post might be better in feature requests but I’m not sure how to move it. Either way I’m looking for input as much as making a request.

1 Like