[Geany] Snippets - support for variable values in multiple places?

Eugene Arshinov earshinov at xxxxx
Wed May 11 10:30:31 UTC 2011


On Wed, 11 May 2011 11:09:43 +0100
Oliver Marks <oliver.marks at gforces.co.uk> wrote:

>       * On Wed, 2011-05-11 at 11:10 +1000, Russell Dickenson wrote:
> > I wonder if it's possible to insert in multiple places within a
> > snippet the same string? For example, I have a snippet which inserts
> > some HTML code that refers to an image and I use the description of
> > the image in two places within the same snippet. As I understand the
> > manual, you insert "%cursor%" anywhere that you want the cursor to
> > jump to so that the user can insert text. If I enter a title for an
> > image in my example snippet I would prefer to have that also
> > inserted elsewhere in the same snippet.
> > 
> This sounds very useful would be something i would like to see but to
> expand a bit what about parameters ie %arg1% %arg2% a dialog could
> then be dynamically generated for the input if needed and the results
> placed in the generated snippet.
> 

It would be nice.  I have one more suggestion: new %selection%
parameter for current selection.  It will make sense when used
together with snippet keybindings.  For example, some users may find
it useful to create HTML snippets like s=<strong>%selection%</strong>
and assign keybindings to them.  Gedit provides this functionality via
$GEDIT_SELECTED_TEXT [1] (though I must note that Gedit snippets
are generally more powerful than Geany's as for today).  Currently I
don't feel the need for such functionality myself (for me, HTML
editing is already comfortable enough with tag autocompletion enabled),
but recently I received a private mail from another user who talked
precisely about that.

[1] <http://live.gnome.org/Gedit/Plugins/Snippets>
 
> It would also be nice if we could have snippets in the snippet file
> over multiple lines because some of mine are very long so it makes it
> hard to spot where i need to put in changes.

--
Best regards,
Eugene.



More information about the Users mailing list