Commit 693869fcf159

Vincent Demeester <vincent@sbr.pm>
2026-03-09 21:15:37
nvim: add tekton-lsp auto-attach for Tekton YAML files
1 parent 6a7aa3b
Changed files (1)
dots
config
nvim
lua
plugins
dots/config/nvim/lua/plugins/tekton.lua
@@ -0,0 +1,20 @@
+-- Tekton LSP: attaches tekton-lsp to YAML files containing tekton.dev apiVersion
+vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
+  group = vim.api.nvim_create_augroup("tekton_lsp_attach", { clear = true }),
+  pattern = { "*.yaml", "*.yml" },
+  callback = function(ev)
+    local lines = vim.api.nvim_buf_get_lines(ev.buf, 0, 50, false)
+    for _, line in ipairs(lines) do
+      if line:match("tekton%.dev") or line:match("triggers%.tekton%.dev") then
+        vim.lsp.start({
+          name = "tekton-lsp",
+          cmd = { "tekton-lsp" },
+          root_dir = vim.fs.root(ev.buf, { ".git" }) or vim.fn.getcwd(),
+        })
+        return
+      end
+    end
+  end,
+})
+
+return {}