Feature Proposal: "Wrap Selection" Snippets (Apply Snippet to Highlighted Text)

I’d like to propose an enhancement to snippets: the ability to apply a snippet to pre-selected text and have the snippet automatically reference that selection.

In practice, this would enable an “enrich” workflow-highlight part of the text and run a snippet that wraps or inserts around the selection (e.g., formatting, templating, adding tags/quotes/links) without changing how I’m editing.

Right now, the closest workaround is using the clipboard flow (cut/copy → run snippet → paste), which adds an extra step (e.g., an additional Ctrl+X/Ctrl+C) and breaks the editing rhythm.

If possible, supporting something like a “selected text” variable (e.g., {selection}) or a “wrap selection” snippet mode would make snippets significantly faster and more intuitive to use.

Hi @sergi,

Thanks for your feature request. We have recently added the {site: selection} command to retrieve the selected text within your snippet. Please feel free to try it and let us know if it meets your use case.

With selection, you can use the context menu or the assistant to insert snippets; otherwise, the selection will collapse.

Note: {site: selection} will keep your snippet formatting but not the formatting from the selected text.

Hi @AshwinMittal,
Thank you for breaking this down. I tried it and can confirm it works well.

That said, triggering the snippet via the context menu is a separate habit to build, so it’s not quite plug-and-play within an existing workflow