mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
added a warning when extra lazyrc is not the last plugin spec
This commit is contained in:
parent
4a821c3b0b
commit
0e46f7bfcc
2 changed files with 21 additions and 3 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
--[[
|
--[[
|
||||||
This extra allows for project-specific plugin specs.
|
Enable project-specific plugin specs.
|
||||||
|
|
||||||
File .lazy.lua:
|
File .lazy.lua:
|
||||||
is read when present in the current working directory
|
is read when present in the current working directory
|
||||||
should return a plugin spec
|
should return a plugin spec
|
||||||
has to be manually trusted for each instance of the file
|
has to be manually trusted for each instance of the file
|
||||||
|
|
||||||
This extra should be the last plugin spec parsed by lazy.nvim
|
This extra should be the last plugin spec added to lazy.nvim
|
||||||
|
|
||||||
See:
|
See:
|
||||||
:h 'exrc'
|
:h 'exrc'
|
||||||
|
|
@ -17,4 +17,23 @@ local file = vim.secure.read(filepath)
|
||||||
if not file then
|
if not file then
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "VeryLazy",
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
local Config = require("lazy.core.config")
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
local lazyrc_idx = Util.plugin.extra_idx("lazyrc")
|
||||||
|
|
||||||
|
if lazyrc_idx and lazyrc_idx ~= #Config.spec.modules then
|
||||||
|
Util.warn({
|
||||||
|
"The `lazyrc` extra must be the last plugin spec added to **lazy.nvim**. ",
|
||||||
|
"",
|
||||||
|
"Add `{ import = 'lazyvim.plugins.extras.lazyrc' }` to file `config.lazy`. ",
|
||||||
|
"Do not use the `LazyExtras` command. ",
|
||||||
|
}, { title = "LazyVim", once = true })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
return loadstring(file)()
|
return loadstring(file)()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ local Config = require("lazyvim.config")
|
||||||
|
|
||||||
-- Some extras need to be loaded before others
|
-- Some extras need to be loaded before others
|
||||||
local prios = {
|
local prios = {
|
||||||
["lazyvim.plugins.extras.lazyrc"] = 1000,
|
|
||||||
["lazyvim.plugins.extras.editor.aerial"] = 100,
|
["lazyvim.plugins.extras.editor.aerial"] = 100,
|
||||||
["lazyvim.plugins.extras.editor.symbols-outline"] = 100,
|
["lazyvim.plugins.extras.editor.symbols-outline"] = 100,
|
||||||
["lazyvim.plugins.extras.test.core"] = 1,
|
["lazyvim.plugins.extras.test.core"] = 1,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue