From c620a3bc08ead339588677cf36c0dd27f1babfe3 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Thu, 4 Aug 2022 10:35:31 +0200 Subject: [PATCH] nvim: run buf lint from discovered buf root if found --- .config/nvim/lua/plugins/null-ls.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.config/nvim/lua/plugins/null-ls.lua b/.config/nvim/lua/plugins/null-ls.lua index d133c9a..63e411d 100644 --- a/.config/nvim/lua/plugins/null-ls.lua +++ b/.config/nvim/lua/plugins/null-ls.lua @@ -10,6 +10,13 @@ null_ls.setup({ builtins.completion.spell, builtins.diagnostics.buf.with({ args = { "lint", "--disable-symlinks", "--path", "$FILENAME" }, + cwd = function() + local file_dir = vim.fn.expand("%:p:h") .. ";" + local buf_yaml = vim.fn.findfile("buf.yaml", file_dir) + if buf_yaml then + return vim.fn.fnamemodify(buf_yaml, ":h") + end + end, }), builtins.diagnostics.buildifier, builtins.diagnostics.cue_fmt,