dotfiles/.config/nvim/lua/plugins/extras/lang/yaml-extended.lua
2024-04-01 13:24:08 +02:00

37 lines
1 KiB
Lua

return {
{ import = "lazyvim.plugins.extras.lang.yaml" },
{
"someone-stole-my-name/yaml-companion.nvim",
ft = { "yaml" },
dependencies = {
{ "neovim/nvim-lspconfig" },
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope.nvim" },
},
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,
},
}