Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created November 28, 2024 15:52
Show Gist options
  • Save johnlindquist/b2fdc2e5c0ee1efb70b9a18e3b18d5b6 to your computer and use it in GitHub Desktop.
Save johnlindquist/b2fdc2e5c0ee1efb70b9a18e3b18d5b6 to your computer and use it in GitHub Desktop.
// Name: Testing Template with Selection
// Shortcut: opt 7
import "@johnlindquist/kit";
const selectedText = await getSelectedText();
const templates = [
{
name: "par",
trigger: "par", // just type "par" and it will run
value: selectedText.trim() ? `(${selectedText}) $0` : `($1)$0`,
},
];
const text = await arg("Select a template", templates);
const result = await template(text);
await setSelectedText(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment