Sublime Forum

Keybinding issues

#1

keybinding… as discussed already there is a problem with the current implementation.

if have you have bindings that look like that:
action1 - a
action2 - a,b
action3 - a,b,c

on the above case sublime won’t trigger actions till it is not absolutely sure the user doesn’t try to do action3, so pressing a and waiting will hang for ever, or at least till you press something different than b. if you wrote all the binding you may know what to expect, but imagine many people wrote their binding, you can never know which sequence was used, and you don’t have any feedback. for example, say another person just added the following bindings:
action 100a - a,b,c,a
action 100b - a,b,c,b

action 100z - a,b,c,z

suddenly you will enter a,b,c, and nothing will happen, more over your bind will never trigger because a,b,c,X is masked by the new bindings.

this system is not good.

VIM solves this by a timeout which after it the editor understands the sequence has ended, only when there is a valid sequence, i.e. it won’t timeout in the middle if there is no valid sequence, so when u have:

action 1 - a,b,c
action 2 - a,b,c,b

and u press a,b and wait, it is ok, then if u press c and pause briefly it will invoke action3

0 Likes

Keybindings and personal muppetry
#2

1++

0 Likes

#3

I’ll add this in the next beta

0 Likes

#4

i was trying to think of a better solution then a timeout (like termination unique key) but i can’t come up with better ideas…

0 Likes

#5

Is this thread abbout snippet keybindings? If so, have you considered making it TextMate-ish?

In TextMate the actual key sequence doesn’t matter. The key, when pressed, makes the editor look at the word to the left of the caret, and trigger the corresponding snippet, if such exists.

In my opinion, this makes much more sense, as making a typo while writing a long snippet name wouldn’t make you start over. :smile:

0 Likes