[Geany-devel] question about snippets

Andreas Mokros am at xxxxx
Sat Jul 4 12:06:12 UTC 2009


One functionality that I _always_ wanted to have for snippet-completion,
is using snippets on a selected text. So that I have "some text"
selected in the editor, then type a hotkey, then type some chars, like
e.g. d-i-v and then I get:
<div>some text</div>
in my editor.
Basically one would need an additional parameter (like %selected%) for
the snippets.conf, so you'll get something like e.g.:
div=<div id="%cursor%">%selected%</div>
For normal snippet-completion with tab, %selected% would be treated
like %cursor%.
When the special hotkey is pressed, every further char must be "eaten"
and the resulting string must be checked against a list of snippets and
when a snippet is matched it is inserted around the selected text in
the editor.
I hacked something like that together using the Lua-plugin and it works
pretty well and I think it's extremely useful especially for
html/xml-editing, so I'm thinking about redoing it in C.
The question is: Would something like this be better as a separate
plugin or added to standard snippet-completion?


More information about the Devel mailing list