From 4a821c3b0b645cde02422e958a2632f97c8629fd Mon Sep 17 00:00:00 2001 From: abeldekat Date: Sun, 3 Dec 2023 10:57:31 +0100 Subject: [PATCH] feat(extras): Enable project-specific plugin specs using .lazy.lua --- lua/lazyvim/plugins/extras/lazyrc.lua | 20 ++++++++++++++++++++ lua/lazyvim/plugins/xtras.lua | 1 + 2 files changed, 21 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lazyrc.lua diff --git a/lua/lazyvim/plugins/extras/lazyrc.lua b/lua/lazyvim/plugins/extras/lazyrc.lua new file mode 100644 index 00000000..1c4d0d62 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lazyrc.lua @@ -0,0 +1,20 @@ +--[[ +This extra allows for project-specific plugin specs. + +File .lazy.lua: + is read when present in the current working directory + should return a plugin spec + has to be manually trusted for each instance of the file + +This extra should be the last plugin spec parsed by lazy.nvim + +See: + :h 'exrc' + :h :trust +--]] +local filepath = vim.fn.fnamemodify(".lazy.lua", ":p") +local file = vim.secure.read(filepath) +if not file then + return {} +end +return loadstring(file)() diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 4eb73804..1ecf081a 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -2,6 +2,7 @@ local Config = require("lazyvim.config") -- Some extras need to be loaded before others local prios = { + ["lazyvim.plugins.extras.lazyrc"] = 1000, ["lazyvim.plugins.extras.editor.aerial"] = 100, ["lazyvim.plugins.extras.editor.symbols-outline"] = 100, ["lazyvim.plugins.extras.test.core"] = 1,