A Neovim plugin that automatically detects and applies YAML schemas for your YAML files using yaml-language-server (yamlls). It can automatically fetch and apply Custom Resource Definition (CRD) schemas from your current Kubernetes cluster.
- Automatic YAML schema detection for your files
- Seamless integration with yaml-language-server and helm-ls
- Dynamic schema switching based on file content
- Support for multiple YAML schemas
- Buffer-specific schema management
- Automatic fetching of Kubernetes CRD schemas from your current cluster
- Real-time schema validation against your cluster's CRDs
- Support for Helm chart files
- Neovim
- yaml-language-server
- helm-ls (for Helm chart support)
- plenary.nvim
Using packer.nvim:
use {
'cwrau/yaml-schema-detect.nvim',
requires = {
'nvim-lua/plenary.nvim',
}
}Using lazy.nvim:
{
'cwrau/yaml-schema-detect.nvim',
---@module "yaml-schema-detect"
---@type YamlSchemaDetectOptions
opts = {}, -- use default options
dependencies = {
'nvim-lua/plenary.nvim',
},
ft = { "yaml", "helm" },
}Plugin ships with some sensible defaults which you can tweak in your own way.
{
disable_keymap = false,
keymap = {
refresh = "<leader>xr",
cleanup = "<leader>xyc",
info = "<leader>xyi",
},
}Using lazy.nvim:
Disable default keybindings entirely:
{
'cwrau/yaml-schema-detect.nvim',
---@module "yaml-schema-detect"
---@type YamlSchemaDetectOptions
opts = {
disable_keymap = true,
},
dependencies = {
'nvim-lua/plenary.nvim',
},
ft = { "yaml", "helm" },
}Change and toggle default keybindings:
{
'cwrau/yaml-schema-detect.nvim',
---@module "yaml-schema-detect"
---@type YamlSchemaDetectOptions
opts = {
keymap = {
refresh = "<leader>yr",
cleanup = "<leader>yc",
info = false,
},
},
dependencies = {
'nvim-lua/plenary.nvim',
},
ft = { "yaml", "helm" },
}The plugin works automatically once installed and configured. It will:
- Detect the appropriate YAML schema for your files
- Update yaml-language-server or helm-ls settings accordingly
- Provide schema-aware completions and validations
The plugin analyses your YAML files and dynamically updates the yaml-language-server or helm-ls configuration to use the most appropriate schema based on the file content and context. For Kubernetes Custom Resources, it automatically connects to your current cluster to fetch the corresponding CRD schemas, ensuring your YAML files are validated against the actual CRD definitions in your cluster.