Home Explore Blog CI



zed

2nd chunk of `docs/src/globs.md`
83b0265b0acd79ccb92432d372766d05e0c25f05ad86c4070000000100000820
| `[abc]`           | Matches any one character in the brackets                         |
| `[a-z]`           | Matches any of a range of characters (ordered by Unicode)         |
| `[!...]`          | The negation of `[...]` (matches a character not in the brackets) |

Notes:

1. Shell-style brace-expansions like `{a,b,c}` are not supported.
2. To match a literal `-` character inside brackets it must come first `[-abc]` or last `[abc-]`.
3. To match the literal `[` character use `[[]` or put it as the first character in the group `[[abc]`.
4. To match the literal `]` character use `[]]` or put it as the last character in the group `[abc]]`.

## Examples

### Matching file extensions

If you wanted to only search Markdown files add `*.md` to the "Include" search field.

### Case insensitive matching

Globs in Zed are case-sensitive, so `*.c` will not match `main.C` (even on case-insensitive filesystems like HFS+/APFS on MacOS). Instead use brackets to match characters. So instead of `*.c` use `*.[cC]`.

### Matching directories

If you wanted to search the [zed repository](https://github.com/zed-industries/zed) for examples of [Configuring Language Servers](https://zed.dev/docs/configuring-languages#configuring-language-servers) (under `"lsp"` in Zed settings.json) you could search for `"lsp"` and in the "Include" filter specify `docs/**/*.md`. This would only match files whose path was under the `docs` directory or any nested subdirectories `**/` of that folder with a filename that ends in `.md`.

If instead you wanted to restrict yourself only to [Zed Language-Specific Documentation](https://zed.dev/docs/languages) pages you could define a narrower pattern of: `docs/src/languages/*.md` this would match [`docs/src/languages/rust.md`](https://github.com/zed-industries/zed/blob/main/docs/src/languages/rust.md) and [`docs/src/languages/cpp.md`](https://github.com/zed-industries/zed/blob/main/docs/src/languages/cpp.md) but not [`docs/src/configuring-languages.md`](https://github.com/zed-industries/zed/blob/main/docs/src/configuring-languages.md).

Title: Glob Pattern Examples and Notes
Summary
This section provides examples and notes on using glob patterns in Zed. It explains how to match characters within brackets, including negation. It also notes that shell-style brace-expansions are not supported and how to match literal '-' , '[' and ']' characters. Examples demonstrate how to use globs for matching file extensions, performing case-insensitive matching, and searching within specific directories and subdirectories. The section highlights the case-sensitivity of globs in Zed and provides workarounds for case-insensitive matching.