dotfiles/.config/nvim/lua/plugins/extras/lang/yaml-extended.lua
2025-02-02 00:43:37 +01:00

32 lines
911 B
Lua

return {
{ import = "lazyvim.plugins.extras.lang.yaml" },
{
"someone-stole-my-name/yaml-companion.nvim",
ft = { "yaml" },
opts = {},
config = function(_, opts)
local cfg = require("yaml-companion").setup(opts)
require("lspconfig")["yamlls"].setup(cfg)
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("yaml_schema")
end)
end,
keys = {
{ "<leader>cy", "<cmd>Telescope yaml_schema<cr>", desc = "YAML Schema" },
},
},
{
"nvim-lualine/lualine.nvim",
optional = true,
opts = function(_, opts)
local function yaml_schema()
local schema = require("yaml-companion").get_buf_schema(0)
if schema.result[1].name == "none" then
return ""
end
return schema.result[1].name
end
table.insert(opts.sections.lualine_x, 1, yaml_schema)
end,
},
}