Format shell scripts (bash, sh, zsh, bats) with shfmt built in: no binary to install, reads .editorconfig, and shows syntax errors.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features


- Format Document for shell scripts. Bash, POSIX sh, zsh, mksh and Bats files are formatted by shfmt, the formatter the shell community standardised on.
- Nothing to install. shfmt is built in as WebAssembly, so there's no Go binary to download, no PATH to fix and no "shfmt not found". It behaves the same on Windows, macOS, Linux, in WSL and in remote containers.
- Your style, not ours. Indentation follows the editor (or
.editorconfig), and every shfmt option is a setting: &&/| at the start of lines, indented case branches, > file spacing, kept alignment, braces on the next line, simplify.
- Reads
.editorconfig the way the shfmt command does, including shell_variant, switch_case_indent and binary_next_line, so your editor and your CI's shfmt -d agree.
- The right dialect automatically.
#!/bin/sh scripts are parsed as POSIX (so Bash-only syntax is flagged), #!/usr/bin/env zsh as zsh, .bats files as Bats.
- Syntax errors as you type, with the exact line and column, in the Problems panel.
- Set as the default formatter for shell scripts, so format on save works right away.
Commands
| Command |
What it does |
Nifty Shell Format: Format Shell Script |
Format the current script (same as Format Document) |
Nifty Shell Format: Check Shell Syntax |
Check the current script for syntax errors |
Settings
| Setting |
Default |
shfmt flag |
What it does |
nifty.shell-format.indent |
-1 |
-i |
Spaces per level, 0 for tabs, -1 to follow the editor |
nifty.shell-format.variant |
auto |
-ln |
bash, posix, mksh, bats or zsh |
nifty.shell-format.binaryNextLine |
false |
-bn |
&&, \|\| and \| start the next line |
nifty.shell-format.switchCaseIndent |
false |
-ci |
Indent case branches |
nifty.shell-format.spaceRedirects |
false |
-sr |
> file instead of >file |
nifty.shell-format.keepPadding |
false |
-kp |
Keep alignment padding |
nifty.shell-format.functionNextLine |
false |
-fn |
Function braces on the next line |
nifty.shell-format.simplify |
false |
-s |
Simplify where possible |
nifty.shell-format.useEditorconfig |
true |
|
Read options from .editorconfig |
nifty.shell-format.validate |
true |
|
Show syntax errors while you type |
Install
- VS Code: search for "Nifty Shell Format" in the Extensions view, or install from the Visual Studio Marketplace.
- Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.
Privacy
This extension collects no telemetry and needs no account.
- Nifty YAML: Formatter, Validator & Converter: Format YAML without losing comments (Kubernetes-style indents), sort keys, lint with yamllint, copy the key path, and convert to and from JSON. (Open VSX)
- Nifty Beautify: Format HTML in PHP, Blade & Twig: Format HTML inside PHP, Blade, Twig, Jinja, Handlebars, ERB and Liquid templates without breaking the template tags. (Open VSX)
- Nifty SQL: SQL Formatter for 20 Dialects: Format SQL in 20 dialects, including dbt and Jinja templates, with your team's settings. (Open VSX)
- Nifty XML: XPath, Formatter & XML to JSON: Evaluate XPath with namespaces, copy the XPath of any element, format, minify, check well-formedness and convert XML to JSON. (Open VSX)
- Nifty HCL Tools: .tf and .hcl Language Support: Fast, lightweight Terraform and OpenTofu support: highlighting, outline, go to definition and references across a module, hovers, completion, undefined-reference errors and formatting. (Open VSX)
- Nifty Nginx: nginx.conf Formatting & IntelliSense: nginx config support: syntax highlighting, formatting, directive completion and docs on hover, context checks, and snippets for reverse proxies, SSL and PHP. (Open VSX)
See all 100+ Nifty extensions and web tools at https://getnifty.dev
| |