Home Download Buy Blog Forum Support

Few questions regarding plugin creation

Few questions regarding plugin creation

Postby tgienger on Sat Sep 07, 2013 10:36 pm

First off, I've made some keybinds and small plugins to allow for a couple things I was missing, Tabbing out of the auto closed brackets - ""{}{]()'' - and dot completion, "." to do autocomplete and placing the dot directly after for a quick and easy (eg. typing: sys. would give you "system." ready for whatever you needed. Before I put them up anywhere I need to clean them up and have a few questions.

1. Can I use commands like "following_text": blah blah blah in python or do those particular commands only work in the keybinds file?
a. How can I use "following_text" with more than one char at a time but only requiring one of them. eg. I want to submit an action IF the following char is " or ' or ( or [ .... etc.


mm.. i think that's all for now. Appreciate any help I can get and hopefully these will come in handy for others as well when I'm finished.
tgienger
 
Posts: 2
Joined: Sat Sep 07, 2013 10:13 pm

Re: Few questions regarding plugin creation

Postby sapphirehamster on Sun Sep 08, 2013 8:50 pm

I do not know of a way to access the query context stuff (like following_text) from python. I'm curious why using it from the keybind file is not sufficient for you.

Typically you would just use the normal view methods to access the file contents. So, for example:
Code: Select all
c = view.substr(view.sel()[0].begin())
if c in '[]{}\'"':
    # The next character is a bracket or quote.   


Also, things like snippets would handle things like "sys." -> "system.". You don't need to drop to Python for that.
sapphirehamster
 
Posts: 91
Joined: Sun Jul 01, 2012 11:19 pm


Return to Plugin Development

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 9 guests