mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-13 10:54:40 +02:00
feat(config): allow to disable loading of the default keymaps/autocmds/options. Fixes #238
This commit is contained in:
parent
d9b1c79c3e
commit
6669e63368
2 changed files with 18 additions and 2 deletions
|
@ -10,6 +10,12 @@ local defaults = {
|
||||||
colorscheme = function()
|
colorscheme = function()
|
||||||
require("tokyonight").load()
|
require("tokyonight").load()
|
||||||
end,
|
end,
|
||||||
|
-- load the default settings
|
||||||
|
defaults = {
|
||||||
|
autocmds = true, -- lazyvim.config.autocmds
|
||||||
|
keymaps = true, -- lazyvim.config.keymaps
|
||||||
|
options = true, -- lazyvim.config.options
|
||||||
|
},
|
||||||
-- icons used by other plugins
|
-- icons used by other plugins
|
||||||
icons = {
|
icons = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
|
@ -120,8 +126,7 @@ end
|
||||||
---@param name "autocmds" | "options" | "keymaps"
|
---@param name "autocmds" | "options" | "keymaps"
|
||||||
function M.load(name)
|
function M.load(name)
|
||||||
local Util = require("lazy.core.util")
|
local Util = require("lazy.core.util")
|
||||||
-- always load lazyvim, then user file
|
local function _load(mod)
|
||||||
for _, mod in ipairs({ "lazyvim.config." .. name, "config." .. name }) do
|
|
||||||
Util.try(function()
|
Util.try(function()
|
||||||
require(mod)
|
require(mod)
|
||||||
end, {
|
end, {
|
||||||
|
@ -134,6 +139,11 @@ function M.load(name)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
-- always load lazyvim, then user file
|
||||||
|
if M.defaults[name] then
|
||||||
|
_load("lazyvim.config." .. name)
|
||||||
|
end
|
||||||
|
_load("config." .. name)
|
||||||
if vim.bo.filetype == "lazy" then
|
if vim.bo.filetype == "lazy" then
|
||||||
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
||||||
vim.cmd([[do VimResized]])
|
vim.cmd([[do VimResized]])
|
||||||
|
|
|
@ -160,6 +160,12 @@ end
|
||||||
function M.update2()
|
function M.update2()
|
||||||
local docs = vim.fs.normalize("~/projects/lazyvim.github.io/docs")
|
local docs = vim.fs.normalize("~/projects/lazyvim.github.io/docs")
|
||||||
|
|
||||||
|
local config = Docs.extract("lua/lazyvim/config/init.lua", "\nlocal defaults = ({.-\n})")
|
||||||
|
|
||||||
|
Docs.save({
|
||||||
|
config = config,
|
||||||
|
}, docs .. "/configuration/index.md")
|
||||||
|
|
||||||
Docs.save({
|
Docs.save({
|
||||||
general = M.general(),
|
general = M.general(),
|
||||||
}, docs .. "/configuration/general.md")
|
}, docs .. "/configuration/general.md")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue