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 [settings]
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 "Log to console": {
22 "prefix": "log",
23 "body": ["console.info(\"Hello, ${1:World}!\")", "$0"],
24 "description": "Logs to console"
25 }
26}
27```
28
29## Scopes
30
31The 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:
32
33| Scope | Filename |
34| ---------- | --------------- |
35| Global | snippets.json |
36| JSX | javascript.json |
37| Plain Text | plaintext.json |
38
39To 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.
40
41## Known Limitations
42
43- Only the first prefix is used when a list of prefixes is passed in.
44- Currently only the `json` snippet file format is supported, even though the `simple-completion-language-server` supports both `json` and `toml` file formats.
45
46## See also
47
48The `feature_paths` option in `simple-completion-language-server` is disabled by default.
49
50If you want to enable it you can add the following to your `settings.json`:
51
52```json [settings]
53{
54 "lsp": {
55 "snippet-completion-server": {
56 "settings": {
57 "feature_paths": true
58 }
59 }
60 }
61}
62```
63
64For more configuration information, see the [`simple-completion-language-server` instructions](https://github.com/zed-industries/simple-completion-language-server/tree/main).