Skip to content

Commit 8c65e46

Browse files
committed
feat: cursor position custom snippet docs
1 parent f05f534 commit 8c65e46

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/07-Features/02-custom-snippets.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,29 @@ It can filter your results quickly and accurately.
9999
/>
100100

101101
---
102+
103+
### Snippet Cursor Position
104+
105+
**Phoenix Code** snippets feature is very powerful. It also allows you to define **cursor positions** within a snippet to make editing even faster.
106+
By adding numbered cursor placeholders, you can jump between key points in the expanded snippet using the `Tab` key.
107+
108+
#### How It Works
109+
110+
Inside the **Template Text**, you can include placeholders like `${1}`, `${2}`, `${3}`, and so on.
111+
When the snippet expands:
112+
1. The cursor starts at `${1}`.
113+
2. After entering your desired text, press `Tab` to move to the next placeholder.
114+
3. Continue pressing `Tab` to cycle through the numbered positions.
115+
4. The cursor finally lands at `${0}`. *If `${0}` isn’t defined, at the **last numbered placeholder***.
116+
117+
Here’s an example of a snippet with numbered cursor placeholders:
118+
119+
![Snippet Cursor Positions](./images/CustomSnippets/snippet-cursor.png "Snippet Cursor Positions")
120+
121+
> To move backward through the placeholders, press `Shift + Tab`.
122+
123+
Once you reach the final cursor position, pressing `Tab` again will **remove any remaining unfilled placeholders** from the expanded snippet.
124+
125+
<VideoPlayer
126+
src="https://docs-images.phcode.dev/videos/custom-snippets/cursor-snippets.mp4"
127+
/>
41.5 KB
Loading

0 commit comments

Comments
 (0)