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