1---
2title: Shell Script
3description: "Configure Shell Script language support in Zed, including language servers, formatting, and debugging."
4---
5
6# Shell Scripts
7
8Shell Scripts (bash, zsh, dash, sh) are supported natively by Zed.
9
10- Tree-sitter: [tree-sitter/tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash)
11
12## Settings
13
14Configure settings in Settings ({#kb zed::OpenSettings}) under Languages > Shell Script, or add to your settings file:
15
16```json [settings]
17 "languages": {
18 "Shell Script": {
19 "tab_size": 2,
20 "hard_tabs": false
21 }
22 }
23```
24
25### Formatting
26
27Zed supports auto-formatting Shell Scripts using external tools like [`shfmt`](https://github.com/mvdan/sh).
28
291. Install `shfmt`:
30
31```sh
32brew install shfmt # macos (homebrew)
33sudo apt-get install shfmt # debian/ubuntu
34dnf install shfmt # fedora
35yum install shfmt # redhat
36pacman -Sy shfmt # archlinux
37choco install shfmt # windows (chocolatey)
38```
39
402. Ensure `shfmt` is available in your path and check the version:
41
42```sh
43which shfmt
44shfmt --version
45```
46
473. Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Shell Script, or add to your settings file:
48
49```json [settings]
50 "languages": {
51 "Shell Script": {
52 "format_on_save": "on",
53 "formatter": {
54 "external": {
55 "command": "shfmt",
56 // Change `--indent 2` to match your preferred tab_size
57 "arguments": ["--filename", "{buffer_path}", "--indent", "2"]
58 }
59 }
60 }
61 }
62```
63
64## See also:
65
66- [Zed Docs: Language Support: Bash](./bash.md)
67- [Zed Docs: Language Support: Fish](./fish.md)