-
Notifications
You must be signed in to change notification settings - Fork 53
Help page: Dynamic Placeholders
Muzhen Gaming edited this page Nov 18, 2024
·
15 revisions
Currently, Dynamic Placeholders are available only in Custom AI Commands. However, I plan to gradually add support in other places as well.
Raycast-g4f implements dynamic placeholders to closely match Raycast AI, enabling portability. As of the latest version, we also offer some additional placeholders to support advanced usage.
The supported placeholders are:
Name | Placeholder | Description |
---|---|---|
Selected Text |
{selection} or {input}
|
Inserts the selected text from the frontmost application. In the context of the AI Chat , the previous message will be inserted instead. |
Clipboard Text | {clipboard} |
Inserts your last copied text. The placeholder will be removed from the snippet when you use it if you have not copied any text recently. |
Date | {date} |
Inserts only the current date like 1 Jun 2022. |
Time | {time} |
Inserts only the current time like 3:05 pm. |
Date & Time | {datetime} |
Inserts both date and time like 1 Jun 2022 at 6:45 pm. |
Weekday | {day} |
Inserts the day of the week like Monday. |
Browser Tab | {browser-tab} |
Inserts the text from the current browser tab. Requires the Browser Extension to be installed. |
Shell Command | {shell} |
Inserts the result of a shell command. Example: {shell | echo "Hello"} . |
Using modifiers, you can change the value of a dynamic placeholder using the {clipboard | uppercase}
syntax. It works on all placeholders.
There are five different modifiers:
-
uppercase
→ transformsFoo
intoFOO
. -
lowercase
→ transformsFoo
intofoo
. -
trim
→ transformsFoo Bar
intoFoo Bar
. It removes the white spaces at the beginning and the end of the value. -
percent-encode
→ transformsFoo Bar
intoFoo%20Bar
. It replaces special characters with their percent-encoded equivalent. -
json-stringify
→ transformsFoo "Bar"
into"Foo \"Bar\""
. It makes sure that the value can be used as a JSON string.
You can specify multiple modifiers in a row: {clipboard | trim | uppercase}
.
Here are some tips and notes to help you turn Dynamic Placeholders into an extremely powerful and versatile tool.
- You can nest placeholders, and they will be processed in depth-first order (inner placeholders are processed first). Example:
{shell | cat "{shell | osascript -e 'tell application "Finder" to get POSIX path of first item of (selection as alias list)'}"}
loads the content of the currently selected file. Notice how we nested ashell
placeholder inside another. Neat!