[wingide-users] Autoclose feature: Insert matching bracket,
parenthesis, brace or quote
Wingware Support
support at wingware.com
Fri Nov 26 10:05:45 MST 2010
On 11/25/10 11:32 PM, Bernhard Enders wrote:
> I would like to know how can I configure Wing IDE in order to make it
> autoclose the following characters: [, (, {, ", '. By autoclose I mean
> inserting matching character (bracket, paren, brace or quote). Komodo
> has this features and I cannot live without it.
This is a feature we'll try to add fairly soon. A work-around would be
to use extension scripts like the following and bind them to keys like
Ctrl-(, Ctrl-[ and so forth:
def auto_close_paren():
ed = wingapi.gApplication.GetActiveEditor()
start, end = ed.GetSelection()
doc = ed.GetDocument()
doc.BeginUndoAction()
try:
if start != end:
doc.DeleteChars(start, end)
doc.InsertChars(start, "()")
ed.SetSelection(start+1, start+1)
finally:
doc.EndUndoAction()
return True
You would drop this into a file in your scripts directory (within the
users settings directory that is listed 5th in Wing's about box) and do
Reload All Scripts in Wing then use the Keyboard / Custom Key Bindings
preference to bind keys to them.
Real auto-editing could include a lot more than this and I hope to work
on this after 4.0 final is out.
Thanks,
--
Stephan Deibel
Wingware | Python IDE
Advancing Software Development
www.wingware.com
More information about the wingide-users
mailing list