1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-01 20:59:26 +00:00

[neovim] Add yaml-companion module and update plugins

This commit is contained in:
2023-02-15 20:19:53 +01:00
parent dd77a5e33b
commit 47a9afae4b
5 changed files with 38 additions and 12 deletions

View File

@ -95,6 +95,12 @@ lazy.setup({
{ "folke/trouble.nvim", cmd = { "TroubleToggle", "Trouble" } },
{ "glepnir/lspsaga.nvim", event = "BufRead" },
{ "arkav/lualine-lsp-progress" },
{
"someone-stole-my-name/yaml-companion.nvim",
config = function()
require("telescope").load_extension("yaml_schema")
end,
},
-- Telescope
{ "nvim-telescope/telescope.nvim", cmd = "Telescope" },

View File

@ -7,5 +7,6 @@ require("plugins.lsp.mason")
require("plugins.lsp.handlers").setup()
require("plugins.lsp.null-ls")
require("plugins.lsp.lsp-saga")
require("plugins.lsp.yaml-companion")
win.default_options.border = "rounded"

View File

@ -0,0 +1,2 @@
local cfg = require("yaml-companion").setup({})
require("lspconfig")["yamlls"].setup(cfg)

View File

@ -26,6 +26,7 @@ local diff = {
local filetype = {
"filetype",
colored = false,
separator = "",
}
local lsp_progress = {
@ -54,6 +55,21 @@ local venv = function()
return ""
end
local get_schema = function()
local ft = vim.bo.filetype or ""
if ft == "yaml" then
local schema = require("yaml-companion").get_buf_schema(0)
if schema.result[1].name == "none" then
return ""
end
return "(" .. schema.result[1].name .. ")"
else
return ""
end
end
local gitblame_status_ok, gitblame = pcall(require, "gitblame")
if not gitblame_status_ok then
return
@ -77,6 +93,7 @@ lualine.setup({
spaces,
"encoding",
filetype,
{ get_schema, separator = "" },
},
lualine_y = { "progress" },
lualine_z = { "location" },