Sublime Forum

Capture a short key and release it back to Sublime?

#1

Suppose I bind a short key say ‘ctrl+c’, I can make it call a method in my package. However, after the method is called, can I release the ‘ctrl+c’ key back to sublime and let it do the original action that it would do (say copying) ?

Same for ‘tab’, I can bind the ‘tab’ key to a method in my package. But conditional on the outcome of the methods, I would like to release the ‘tab’ key back to Sublime and let it do the snippet insertion, completion …etc. Is it possible to do something like this?

0 Likes

#2

Yep :smiley:

[pre=#2A2A2A]on_query_context(view, key, operator, operand, match_all)[/pre]

On_query_context is awesome. Unfortunately, I can’t show you an example from my code (my plugin’s not released yet) but you can check out usage in the Vintage package.

Essentially, when you set up a keybinding, you can create your own custom ‘contexts.’ If your context matches, the binding is captured, else it is ignored.

0 Likes

#3

yup I think I know how to use “context” (checking settings, or scope…etc) , but the problem is I dunno how to use the result of a method as the context…

I think I will check the on_query_context…thanks

0 Likes

#4

github.com/sublimehq/Vintage/bl … ge.py#L151

0 Likes