Nifty YAML
Format YAML without losing comments (Kubernetes-style indents), sort keys, lint with yamllint, copy the key path, and convert to and from JSON.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features




- Format YAML without losing anything. Comments, anchors and aliases, block scalars (
| and >), and multiple --- documents all survive. Works with Format Document and format on save in .yaml, Docker Compose and GitHub Actions files.
- Kubernetes-style indentation.
- item lists are indented under their key, like Prettier and kubectl output. Prefer them flush with the key? Turn off nifty.yaml.indentSequences.
- Sort Keys at every level, numbers in natural order (
item2 before item10), with comments kept next to their entries.
- yamllint built in. If yamllint is installed (
pip install yamllint), its problems show in the Problems panel as you type, using your project's .yamllint config. Each problem links to the rule's docs.
- Syntax errors and duplicate keys are flagged even without yamllint. If you use Red Hat's YAML extension this is left to it, so nothing is reported twice.
- Where am I? The key path under the cursor (
spec.template.spec.containers[0].image) is shown in the status bar. Click it, or use Copy Key Path, to copy it.
- Convert YAML to JSON and JSON to YAML (the whole file or the selection).
- Works in the browser on vscode.dev and github.dev; linting with yamllint needs the desktop app.
Commands
| Command |
What it does |
Nifty YAML: Format YAML |
Format the file (same as Format Document) |
Nifty YAML: Sort Keys |
Sort mapping keys at every level |
Nifty YAML: Copy Key Path |
Copy the path of the key under the cursor |
Nifty YAML: Convert YAML to JSON |
Open the file as JSON beside it |
Nifty YAML: Convert JSON to YAML |
Open a JSON file (or selection) as YAML |
Nifty YAML: Lint YAML Now |
Re-run the checks on the current file |
Settings
| Setting |
Default |
What it does |
nifty.yaml.indent |
0 |
Spaces per level. 0 uses the editor's tab size |
nifty.yaml.indentSequences |
true |
Indent - item lists under their key |
nifty.yaml.lineWidth |
0 |
Fold long strings at this width (0 never folds) |
nifty.yaml.quoteStyle |
preserve |
single or double converts quoted strings |
nifty.yaml.documentStart |
false |
Always start with --- |
nifty.yaml.sortKeysOnFormat |
false |
Sort keys every time you format |
nifty.yaml.validate |
auto |
Report syntax errors and duplicate keys |
nifty.yaml.yamllint |
auto |
Run yamllint when installed (on warns if it's missing) |
nifty.yaml.yamllintPath |
"" |
Path to yamllint |
nifty.yaml.showPathInStatusBar |
true |
Show the key path in the status bar |
Nifty YAML is set as the default formatter for YAML, Docker Compose and GitHub Actions files. To use a different formatter, set editor.defaultFormatter for [yaml] in your settings.
Install
- VS Code: search for "Nifty YAML" 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 Java Quality: Format, Checkstyle & PMD: Format Java with google-java-format or palantir-java-format, and see Checkstyle and PMD problems as you save. Tools download from Maven Central when you say so; zero setup for Maven and Gradle. (Open VSX)
- Nifty Helm & Kustomize: Values IntelliSense: Helm .Values IntelliSense (completion, hover, go to definition, missing values) and Kustomize navigation, checks with quick fixes, an overlay tree, patch target hovers, build previews and diffs. (Open VSX)
- Nifty Shell Format: shfmt Formatter for Bash: Format shell scripts (bash, sh, zsh, bats) with shfmt built in: no binary to install, reads .editorconfig, and shows syntax errors. (Open VSX)
- Nifty Templates: Jinja, Twig & Nunjucks: Jinja, Twig and Nunjucks: highlighting in HTML, YAML and any file, block formatting, outline and folding, unclosed-tag errors, completion with docs, snippets, and go to definition for templates. (Open VSX)
- Nifty Actions: Workflow Checks, SHA Pinning & act: GitHub Actions workflows without sign-in: completion and go to definition for local and reusable actions, actionlint checks, pin actions to commit SHAs, and run jobs locally with act. (Open VSX)
- Nifty PHP Quality: PHPStan, PHPCS & Pint: PHPStan, PHP_CodeSniffer, Laravel Pint and PHP-CS-Fixer in one extension: problems as you save, one Fix command, and zero setup when the tools are in your project's vendor/bin. (Open VSX)
See all 100+ Nifty extensions and web tools at https://getnifty.dev
| |