1---
2title: Snippets - Zed
3description: Create and use code snippets in Zed with tab stops, placeholders, variables, and language-scoped triggers.
4---
5
6# Snippets
7
8Use the {#action snippets::ConfigureSnippets} action to create a new snippets file or edit an existing snippets file for a specified [scope](#scopes).
9
10The snippets are located in `~/.config/zed/snippets` directory to which you can navigate to with the {#action snippets::OpenFolder} action.
11
12## Example configuration
13
14```json
15{
16 // Each snippet must have a name and body, but the prefix and description are optional.
17 // The prefix is used to trigger the snippet, but when omitted then the name is used.
18 // Use placeholders like $1, $2 or ${1:defaultValue} to define tab stops.
19 // The $0 determines the final cursor position.
20 // Placeholders with the same value are linked.
21 // If the snippet contains the $ symbol outside of a placeholder, it must be escaped with two slashes (e.g. \\$var).
22 "Log to console": {
23 "prefix": "log",
24 "body": ["console.info(\"Hello, ${1:World}!\")", "$0"],
25 "description": "Logs to console"
26 }
27}
28```
29
30## Scopes
31
32The scope is determined by the language name in lowercase e.g. `python.json` for Python, `shell script.json` for Shell Script, but there are some exceptions to this rule:
33
34| Scope | Filename |
35| ---------- | --------------- |
36| Global | snippets.json |
37| JSX | javascript.json |
38| Plain Text | plaintext.json |
39
40To create JSX snippets you have to use `javascript.json` snippets file, instead of `jsx.json`, but this does not apply to TSX and TypeScript which follow the above rule.
41
42## Known Limitations
43
44- Only the first prefix is used when a list of prefixes is passed in.
45- Currently only the `json` snippet file format is supported, even though the `simple-completion-language-server` supports both `json` and `toml` file formats.
46
47## See also
48
49The `feature_paths` option in `simple-completion-language-server` is disabled by default.
50
51If you want to enable it you can add the following to your `settings.json`:
52
53```json [settings]
54{
55 "lsp": {
56 "snippet-completion-server": {
57 "settings": {
58 "feature_paths": true
59 }
60 }
61 }
62}
63```
64
65For more configuration information, see the [`simple-completion-language-server` instructions](https://github.com/zed-industries/simple-completion-language-server/tree/main).