Home Download Buy Blog Forum Support

Capture a short key and release it back to Sublime?

Capture a short key and release it back to Sublime?

Postby erinata on Sun Apr 22, 2012 1:12 am

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?
erinata
 
Posts: 29
Joined: Wed Jan 25, 2012 12:19 pm

Re: Capture a short key and release it back to Sublime?

Postby C0D312 on Sun Apr 22, 2012 1:56 am

Yep :D

on_query_context(view, key, operator, operand, match_all)


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.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Capture a short key and release it back to Sublime?

Postby erinata on Sun Apr 22, 2012 11:50 am

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
erinata
 
Posts: 29
Joined: Wed Jan 25, 2012 12:19 pm



Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 4 guests