mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-28 11:24:14 +00:00
feat(loader): warn when maplocalleader is changed after init
This commit is contained in:
parent
aedcd79811
commit
d3d13bc4e0
4 changed files with 13 additions and 0 deletions
|
@ -67,6 +67,7 @@ require("lazy").setup(plugins, opts)
|
||||||
```lua
|
```lua
|
||||||
-- Example using a list of specs with the default options
|
-- Example using a list of specs with the default options
|
||||||
vim.g.mapleader = " " -- Make sure to set `mapleader` before lazy so your mappings are correct
|
vim.g.mapleader = " " -- Make sure to set `mapleader` before lazy so your mappings are correct
|
||||||
|
vim.g.maplocalleader = "_" -- Same for `maplocalleader`
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
|
|
|
@ -199,6 +199,9 @@ M.me = nil
|
||||||
---@type string
|
---@type string
|
||||||
M.mapleader = nil
|
M.mapleader = nil
|
||||||
|
|
||||||
|
---@type string
|
||||||
|
M.maplocalleader = nil
|
||||||
|
|
||||||
function M.headless()
|
function M.headless()
|
||||||
return #vim.api.nvim_list_uis() == 0
|
return #vim.api.nvim_list_uis() == 0
|
||||||
end
|
end
|
||||||
|
@ -245,6 +248,7 @@ function M.setup(opts)
|
||||||
-- disable plugin loading since we do all of that ourselves
|
-- disable plugin loading since we do all of that ourselves
|
||||||
vim.go.loadplugins = false
|
vim.go.loadplugins = false
|
||||||
M.mapleader = vim.g.mapleader
|
M.mapleader = vim.g.mapleader
|
||||||
|
M.maplocalleader = vim.g.maplocalleader
|
||||||
|
|
||||||
if M.headless() then
|
if M.headless() then
|
||||||
require("lazy.view.commands").setup()
|
require("lazy.view.commands").setup()
|
||||||
|
|
|
@ -50,6 +50,7 @@ function M.setup()
|
||||||
Util.track()
|
Util.track()
|
||||||
end
|
end
|
||||||
Config.mapleader = vim.g.mapleader
|
Config.mapleader = vim.g.mapleader
|
||||||
|
Config.maplocalleader = vim.g.maplocalleader
|
||||||
|
|
||||||
-- report any warnings & errors
|
-- report any warnings & errors
|
||||||
Config.spec:report()
|
Config.spec:report()
|
||||||
|
|
|
@ -76,6 +76,13 @@ function M.check(start)
|
||||||
Config.mapleader = vim.g.mapleader
|
Config.mapleader = vim.g.mapleader
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Loader.init_done and Config.maplocalleader ~= vim.g.maplocalleader then
|
||||||
|
vim.schedule(function()
|
||||||
|
require("lazy.core.util").warn("You need to set `vim.g.maplocalleader` **BEFORE** loading lazy")
|
||||||
|
end)
|
||||||
|
Config.maplocalleader = vim.g.maplocalleader
|
||||||
|
end
|
||||||
|
|
||||||
if not (start or #changes == 0) then
|
if not (start or #changes == 0) then
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
if Config.options.change_detection.notify and not Config.headless() then
|
if Config.options.change_detection.notify and not Config.headless() then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue