Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

using $SELECTION variable in snippets

37 views
Skip to first unread message

Ken Ledeen

unread,
Dec 29, 2024, 8:03:07 PM12/29/24
to Frescobaldi
Hi All,

Forgive my ignorance.  I would like to create a simple snippet that uses the selected text several times;   For example, if I select “abc” the snippet would produce:

abcLH = {   }
abcRH = {  }

I encountered two problems.  FIrst, $SELECTION was fine for the 1st instance only - not for the 2nd.   It was as if it lost the value after the 1st insertion.

Next, I couldn’t concatenate the $SELECTION with the subsequent text.  I needed to leave a space, or it was interpreted $SELECTIONLH as variable name.

Any suggestions would be much apprepciated

Ken

Message has been deleted
Message has been deleted

Peter Bjuhr

unread,
Dec 30, 2024, 3:54:16 PM12/30/24
to fresc...@googlegroups.com
Hi Ken,

Could you post your snippet? For more complex usage it's probably better to use a Python snippet.

Best wishes
Peter

--
Frescobaldi homepage: http://www.frescobaldi.org/
Mailing list: http://groups.google.com/group/frescobaldi
Issue tracker: https://github.com/frescobaldi/frescobaldi/issues
---
You received this message because you are subscribed to the Google Groups "Frescobaldi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to frescobaldi...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/frescobaldi/4d4cb6cb-cdb8-433a-825b-ac7af594ff7en%40googlegroups.com.

Jakub Pavlík

unread,
Jan 2, 2025, 3:31:43 AMJan 2
to Frescobaldi
Hi,

both using $SELECTION more than once and inserting $SELECTION without surrounding space seems to be impossible with simple snippets. Use a Python snippet instead. (I tried to post a code example, but it seems that Google spam filters consider code harmful and the message was deleted. Let's see if this one will pass through.)

Best regards,
Jakub

Jakub Pavlík

unread,
Jan 2, 2025, 3:31:50 AMJan 2
to Frescobaldi
Hi,

both using $SELECTION repeatedly and inserting $SELECTION without surrounding space doesn't seem to be possible with simple snippets. Use a Python snippet instead:

-*- python;
text = text + '''LH = { }
''' + text + 'RH = { }'
# snippet ends here

Best regards,
Jakub

On Monday, December 30, 2024 at 2:03:07 AM UTC+1 kle...@nevo.com wrote:
Reply all
Reply to author
Forward
0 new messages