Re: [code] [textadept] Is there a way to enclose text in Snippets?

From: Mitchell <>
Date: Fri, 24 Mar 2017 13:57:36 -0400 (EDT)

Hi Sebastian,

On Fri, 24 Mar 2017, cryo shock wrote:

> I noticed some other things about pasting snippets as well:
> %0 placeholder is working differently than %1 not only when using
> <selected_text> with them.
> A list for example can't be created with %0{left,right,mid}. It only works
> with integers > 0. But that might be intention although I haven't read
> about it in the manual.
> There is another thing that only occurs when using integers > 0:
> When you take the snippet
> {\\bf %0%0<selected_text>}
> for example, then you can also switch the position of the second
> placeholder %0:
> {\\bf %0<selected_text>%0}
> There is no difference when pasting either snippet as far as I can tell. I
> tried with and without selected text.

`%0` is only for the final caret position. It is not a normal placeholder.
If you want lists and such, use `%n` for n > 0.

In case you did not see, snippet documentation is here:

> But when you do this with an int > 0 then there is a difference how
> snippets are pasted:
> I tried the same as above:
> {\\bf %0%1<selected_text>}
> As we already noticed, with highlighted text the selection gets deleted.
> Without highlight the cursor jumps to %0%1 like {\bf _}.
> The other variant:
> {\\bf %0<selected_text>%1}
> behaves the same as it deletes highlighted text, without highlighted text
> the cursor jumps to %0 or %1 (I can't say) to {\bf _}, BUT then also a
> space gets created after the closing brace.

As I mentioned in a previous e-mail, use `%<selected_text>` for immediate
insertion of selected text into a snippet. You don't want a placeholder


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Fri 24 Mar 2017 - 13:57:36 EDT

This archive was generated by hypermail 2.2.0 : Sat 25 Mar 2017 - 06:28:29 EDT