mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix: add yaml companion to yaml setup
This commit is contained in:
parent
97480dc5d2
commit
c39111af25
1 changed files with 37 additions and 0 deletions
|
|
@ -74,4 +74,41 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- support auto-detecting and selecting yaml schemas.
|
||||||
|
-- use ":Telescope yaml_schema" to change current schema.
|
||||||
|
{
|
||||||
|
"someone-stole-my-name/yaml-companion.nvim",
|
||||||
|
ft = { "yaml" },
|
||||||
|
dependencies = {
|
||||||
|
{ "neovim/nvim-lspconfig" },
|
||||||
|
{ "nvim-lua/plenary.nvim" },
|
||||||
|
{ "nvim-telescope/telescope.nvim" },
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local cfg = require("yaml-companion").setup(opts)
|
||||||
|
require("lspconfig")["yamlls"].setup(cfg)
|
||||||
|
require("telescope").load_extension("yaml_schema")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Show currently used yaml-schema on lualine status bar
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.sections.lualine_z = {
|
||||||
|
{
|
||||||
|
function()
|
||||||
|
local schema = require("yaml-companion").get_buf_schema(0)
|
||||||
|
if schema.result[1].name == "none" then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
return schema.result[1].name
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
opts.sections.lualine_z,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue