From 251539979eac45798caa0daa2263250be96367a7 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Mon, 18 Sep 2023 00:45:46 +0200 Subject: [PATCH] nvim: yaml schema goodness --- .config/nvim/lua/config/lazy.lua | 78 +++++++++++++++---------------- .config/nvim/lua/plugins/yaml.lua | 25 ++++++++++ 2 files changed, 64 insertions(+), 39 deletions(-) create mode 100644 .config/nvim/lua/plugins/yaml.lua diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua index 5f07074..cf0f003 100644 --- a/.config/nvim/lua/config/lazy.lua +++ b/.config/nvim/lua/config/lazy.lua @@ -7,43 +7,43 @@ end vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazy").setup({ - spec = { - -- add LazyVim and import its plugins - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- import any extras modules here - -- { import = "lazyvim.plugins.extras.lang.json" }, - -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, - { import = "lazyvim.plugins.extras.coding.copilot" }, - { import = "lazyvim.plugins.extras.lang.go" }, - { import = "lazyvim.plugins.extras.lang.typescript" }, - { import = "lazyvim.plugins.extras.lang.yaml" }, - -- import/override with your plugins - { import = "plugins" }, - }, - defaults = { - -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. - -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. - lazy = false, - -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, - -- have outdated releases, which may break your Neovim install. - version = false, -- always use the latest git commit - -- version = "*", -- try installing the latest stable version for plugins that support semver - }, - install = { colorscheme = { "noirbuddy", "tokyonight", "habamax" } }, - checker = { enabled = true }, -- automatically check for plugin updates - performance = { - rtp = { - -- disable some rtp plugins - disabled_plugins = { - "gzip", - -- "matchit", - -- "matchparen", - -- "netrwPlugin", - "tarPlugin", - "tohtml", - "tutor", - "zipPlugin", - }, - }, - }, + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here + -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, + { import = "lazyvim.plugins.extras.coding.copilot" }, + { import = "lazyvim.plugins.extras.lang.go" }, + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.yaml" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "noirbuddy", "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, }) diff --git a/.config/nvim/lua/plugins/yaml.lua b/.config/nvim/lua/plugins/yaml.lua new file mode 100644 index 0000000..d14f2a4 --- /dev/null +++ b/.config/nvim/lua/plugins/yaml.lua @@ -0,0 +1,25 @@ +return { + { + "someone-stole-my-name/yaml-companion.nvim", + dependencies = { + { "neovim/nvim-lspconfig" }, + { "nvim-lua/plenary.nvim" }, + { "nvim-telescope/telescope.nvim" }, + }, + config = function() + require("yaml-companion").setup() + require("telescope").load_extension("yaml_schema") + local cfg = require("yaml-companion").setup({ + -- Add any options here, or leave empty to use the default settings + -- Additional schemas available in Telescope picker + schemas = { + { + name = "Kubernetes 1.25.9", + uri = "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.25.9-standalone-strict/all.json", + }, + }, + }) + require("lspconfig")["yamlls"].setup(cfg) + end, + }, +}