Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] LazyVim setup #44

Open
Dogacel opened this issue Apr 1, 2024 · 2 comments
Open

[Feature] LazyVim setup #44

Dogacel opened this issue Apr 1, 2024 · 2 comments

Comments

@Dogacel
Copy link

Dogacel commented Apr 1, 2024

I tried using this plugin with LazyVim, I spent a lot of time and realized the solution was hidden under the following issue with a cryptic name 😅

So in short, here is how I done it:

lua/plugins/yaml-companion.lua

return {
  {
    "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,
  },
}

Here is

lua/plugins/lualine.lua

return {
  "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,
      },
      {
        function()
          return "" .. os.date("%R")
        end,
      },
    }
  end,
}
@Dogacel
Copy link
Author

Dogacel commented Apr 1, 2024

@someone-stole-my-name I can open a PR to update the README.md.

@thinktainer
Copy link

lifesaver, was going crazy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants