Home Download Buy Blog Forum Support

call function when completion selected? on_query_completions

call function when completion selected? on_query_completions

Postby gregor.hoch on Fri Oct 05, 2012 3:59 pm

Hi,
I am using `on_query_completions` to add some custom completions and was wondering whether it's possible to call a function when a specific completion is selected?

Below is an example for my returned listed. When the user selects `cite`, the curser jumps to the place between the curled brackets {}. Now I would like to automatically call a function (for tex people, I would like to call the function that allows me to select the bibtex key). Is that possible?

Thanks!

Code: Select all
["cite\t(author year)", "citep{$1}"),
("section\tSection*", "section*{$1}\n$0")]
gregor.hoch
 
Posts: 143
Joined: Sat Oct 01, 2011 7:54 pm

Re: call function when completion selected? on_query_completions

Postby agibsonsw on Sat Oct 06, 2012 4:15 pm

There is no on_completion_selected event unfortunately. You could use on_modified to constantly monitor the view and read the text in and around the cursor position. This might be overkill though, as you could just assign a key-binding to invoke a macro, command, etc..
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests