From 5426461deaa5491454eb8b2fdc651a8be5774617 Mon Sep 17 00:00:00 2001 From: FaultyBranches Date: Tue, 21 Apr 2026 09:05:45 -0500 Subject: [PATCH] exp: Testing out yaml-companion plugin, moving nvim-lint to being on a hotkey rather than on bufread and bufwrite --- nvim/after/lsp/yamlls.lua | 12 +++++++++--- nvim/lua/plugins.lua | 2 ++ nvim/lua/plugins/lualine.lua | 20 +++++++++++++------- nvim/lua/plugins/nvim-lint.lua | 18 +++++++++++++----- nvim/lua/plugins/yaml-companion.lua | 8 ++++++++ 5 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 nvim/lua/plugins/yaml-companion.lua diff --git a/nvim/after/lsp/yamlls.lua b/nvim/after/lsp/yamlls.lua index 37e648e..e386a9a 100644 --- a/nvim/after/lsp/yamlls.lua +++ b/nvim/after/lsp/yamlls.lua @@ -1,9 +1,15 @@ return { settings = { + redhat = { + telemetry = { + enabled = false + } + }, yaml = { - -- schemaStore = { - -- enable = true - -- }, + validate = true, + schemaStore = { + enable = true + }, format = { enable = true, singleQuote = true diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 84f1087..b43dac1 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -35,4 +35,6 @@ require('lazy').setup({ require('plugins.render-markdown'), -- Render markdown directly in nvim (experimental, may take over for markdown-preview) require('plugins.autopairs'), -- Autocomplete symbol pairs when typing (experimental) require('plugins.twilight'), -- Focus mode, dim lines around the current segment of code + require('plugins.yaml-companion'), -- Additional YAML and JSON schema helper + -- require('plugins.schemastore'), -- Loads YAML and JSON schemas for autocompletion }) diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua index 45a804d..437414f 100644 --- a/nvim/lua/plugins/lualine.lua +++ b/nvim/lua/plugins/lualine.lua @@ -1,14 +1,15 @@ +local function get_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 + return { 'nvim-lualine/lualine.nvim', config = function() require('lualine').setup { - -- options = { - -- component_separators = { left = '\\', right = '/' }, - -- component_separators = { left = '⧹', right = '⧸' }, - -- section_separators = { left = '', right = '' }, - -- globalstatus = true, - -- theme = 'gruvbox', - -- }, tabline = { lualine_a = { 'tabs', @@ -16,6 +17,11 @@ return { lualine_z = { 'buffers', } + }, + sections = { + lualine_x = { + 'encoding', 'fileformat', 'filetype', get_schema + }, } } end, diff --git a/nvim/lua/plugins/nvim-lint.lua b/nvim/lua/plugins/nvim-lint.lua index b58f1d7..091d0f5 100644 --- a/nvim/lua/plugins/nvim-lint.lua +++ b/nvim/lua/plugins/nvim-lint.lua @@ -5,10 +5,18 @@ return { yaml = { 'cfn_lint' } } - vim.api.nvim_create_autocmd({ 'BufWritePost', 'BufReadPost' }, { - callback = function() - require('lint').try_lint() - end, - }) + -- vim.api.nvim_create_autocmd({ 'BufWritePost', 'BufReadPost' }, { + -- callback = function() + -- require('lint').try_lint() + -- end, + -- }) end, + keys = { + { + ';l', + function() + require('lint').try_lint() + end + }, + }, } diff --git a/nvim/lua/plugins/yaml-companion.lua b/nvim/lua/plugins/yaml-companion.lua new file mode 100644 index 0000000..63f4d65 --- /dev/null +++ b/nvim/lua/plugins/yaml-companion.lua @@ -0,0 +1,8 @@ +return { + 'mosheavni/yaml-companion.nvim', + config = function(_, opts) + local cfg = require('yaml-companion').setup(opts) + vim.lsp.config('yamlls', cfg) + vim.lsp.enable('yamlls') + end, +}