[Geany-devel] question about snippets

Enrico Tröger enrico.troeger at xxxxx
Sat Jul 4 13:39:16 UTC 2009


On Sat, 4 Jul 2009 14:06:12 +0200, Andreas wrote:

>Hi.
>
>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?

Depends on how well it integrates into the current code. It's easy to
break the snippet completion and the code is already a mess.
OTOH assuming your changes won't result in 3000 new lines of code, it's
probably not worth putting it into a plugin.

After all: not sure :).

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090704/56d846e0/attachment.pgp>


More information about the Devel mailing list