Sublime Forum

Programmatic access to "previous key" pressed

#1

Apologies if this is discussed already somewhere…

I’m looking for programmatic (macro/plugin/command context, whatever) access to the previous key pressed. Specifically, what I mean is that I would like to bind a key to a function that can tell what key triggered the function to be called, as well as which key was pressed previously.

For example, I would like to run some code when the key is pressed, and then if it’s pressed again immediately after, run different code.

Thanks

0 Likes

#2

You can bind a command to , (i.e. two presses in a row).
Excerpt from the Origami keymap:

{ "keys": "super+k", "up"], "command": "travel_to_pane", "args": {"direction": "up"} },

0 Likes