Tip
π·πΊ Π ΡΡΡΠΊΠ°Ρ Π²Π΅ΡΡΠΈΡ: ARCHITECTURE.ru.md
How lazyvimx works on the inside.
- Overview
- Bootstrap Process
- Configuration System
- Extras System
- Overrides System
- Utilities
- Integration Points
lazyvimx is a layer on top of LazyVim, not a fork: nothing in LazyVim gets replaced, every
enhancement is plugged in through lazy.nvim's standard machinery (specs, import,
optional, cond).
- Don't interfere β LazyVim works as usual, everything extra is optional
- Modularity β one feature = one file
- Extensibility β your own plugins and overrides plug in alongside
- Lightness β lazy loading, conditional activation
- Friendly to the environment β chezmoi, VSCode, the system theme
| Kind | Where | What it is |
|---|---|---|
| Extras | lua/lazyvimx/extras/ |
Optional features; enabled explicitly (:LazyExtras / import) |
| Overrides | lua/lazyvimx/overrides/ |
Tweaks to existing plugin settings; enabled in bundles |
| Utilities | lua/lazyvimx/util/ |
Shared functions for extras, overrides, and user configs |
The init.lua at the repository root configures nothing β it only warns if the repository
is mistakenly used as a standalone Neovim config.
The entry point is { "lazyvimx/nvim", name = "lazyvimx", import = "lazyvimx.boot" }. The module returns a
sequence of specs:
return {
{ import = "system.plug", enabled = set_global }, -- 1
{ import = "system.plug", enabled = vimopts_create_autocmd }, -- 2
{ "LazyVim/LazyVim", branch = "main" }, -- 3
{ "LazyVim/LazyVim", opts = update_root_lsp_ignore }, -- 4
{ "LazyVim/LazyVim", opts = insert_extras }, -- 5
{ "LazyVim/LazyVim", import = "lazyvim.plugins" }, -- 6
{ "LazyVim/LazyVim", opts = set_colorscheme }, -- 7
{ "lazyvimx/nvim", name = "lazyvimx", dependencies = { "LazyVim/LazyVim" }, vscode = true, config = true }, -- 8
{ import = "plugins", enabled = has_plugins_dir }, -- 9
}The system.plug specs are a trick: a non-existent plugin with a function in enabled runs
a side effect during spec parsing, before anything loads.
- Globals:
lazyvim_check_order = false,xtras_prios = {},lazyvim_explorer = "neo-tree" - Vim options: a subscription to
LazyVimOptionsDefaultsβ the values apply once LazyVim sets its defaults (tab indentation of 4,backupinstead of swap,winblend/pumblend, timeouts, etc.) - LazyVim is pinned to the
mainbranch eslintis added toroot_lsp_ignore(doesn't affect project root detection)- Extras registration: the lazyvimx section (the σ°¬ icon) appears in
:LazyExtras - LazyVim's plugins load
- Colorscheme: the variant for the current system theme is picked (
get_flavor()) - lazyvimx itself:
config = truecallsrequire("lazyvimx").setup(opts)with the spec's options - The user's
lua/plugins/*.lua, if the directory is non-empty
- Defaults are declared in
lua/lazyvimx/init.lua - User options arrive from the spec's
opts(or a directsetup()call) vim.tbl_deep_extend("force", defaults, opts)β a deep merge- The result is available to every module:
require("lazyvimx").config
colorschemeβ the default colorscheme householdcolorscheme_householdsβ households: lists of dark and light variantsbufferline_groupsβ user buffer groups
Format and defaults β in Configuration.
util/general.lua, the get_flavor() function:
function M.get_flavor(colorscheme_household_last)
local config = require("lazyvimx").config
local flavor_index = M.theme_is_dark() and 1 or 2 -- [1] dark, [2] light
-- with last-color.nvim present, try restoring the last variant
-- (only within the list matching the current system theme)
local flavor_list = config.colorscheme_households[colorscheme_household_last or config.colorscheme]
return flavor_list[flavor_index][1]
endThe household is derived from the theme name's prefix up to the first hyphen:
catppuccin-latte β catppuccin, nord-light β nord.
extras/
βββ core/ # Bundles (5): all, colorschemes, extras, keys, overrides
βββ ui/ # Interface (22)
βββ motions/ # Navigation (6)
βββ buf/ # Buffers (4)
βββ git/ # Git (4)
βββ lang/ # Languages (4)
βββ perf/ # Performance (4)
βββ coding/ # Coding tools (2)
βββ linting/ # Linters (2)
βββ colorschemes/ # Colorschemes (1)
βββ dap/ # Debugging (1)
βββ test/ # Testing (1)
51 feature extras; descriptions are in Extras.
Each extra is a module returning a lazy.nvim spec. The desc field shows up in
:LazyExtras:
return {
"author/plugin.nvim",
desc = "What the extra does",
opts = { ... },
}core.allβ imports the other four plus a notification about recommended LazyVim extrascore.extrasβ the registry of every feature extra (49 imports;ui.better-progressbarβ behind aTERM=xterm-ghosttycondition)core.overridesβ all 4 override categoriescore.colorschemesβ additional colorschemescore.keysβ keymaps bound to plugins (optional = true: no plugin β no keymap)
Extras with external dependencies activate via cond and warn via warn_missing_extra():
-- dap/vscode-js.lua
cond = function()
return not vim.g.vscode and LazyVim.has_extra("dap.core")
endSome modules disable themselves entirely: ui.simple-mode and the VSCode override return
{} when their condition doesn't hold.
Overrides change the settings of existing plugins without replacing them. Every spec is
optional = true: if the plugin isn't there, the override does nothing.
overrides/
βββ lazyvim/ # LazyVim (9): language specifics (clangd, oxc, svelte), chezmoi,
β # theme auto-switching, VSCode, pretty path, the context menu
βββ snacks/ # Snacks.nvim (9): the dashboard, lazygit (theme, follow worktree),
β # disabled animations and backdrop, repeatable buffer deletion
βββ bufferline/ # Bufferline (6): groups, repeatable moves, tab styling
βββ other/ # Other (15): avante, blink, catppuccin, dap-ui, edgy, flash, gitsigns,
# lazy, lspconfig, lualine, neo-tree, noice, sidekick, tokyonight, trouble
39 modules total. A category is imported as a whole β lazy.nvim picks up every .lua file
in the directory:
{ import = "lazyvimx.overrides.snacks" }Extending opts β the most frequent:
return {
"plugin/name",
optional = true,
opts = { option = value },
}Replacing a function β when opts aren't enough:
-- overrides/lazyvim/lualine-pretty-path.lua
opts = function()
LazyVim.lualine.pretty_path = function(opts) --[[ custom implementation ]] end
endAutocmd β reacting to events:
-- overrides/lazyvim/auto-switch-colorscheme-on-signal.lua
vim.api.nvim_create_autocmd("Signal", {
callback = vim.schedule_wrap(colorscheme_update),
})Wrapping β changing behavior while keeping the original:
-- extras/motions/langmapper.lua
local normkey_orig = Snacks.util.normkey
Snacks.util.normkey = function(key)
return normkey_orig(translate_key(key, "default", "ru"))
endColor blending, system theme detection, colorscheme variant selection, extras checks. The full reference is in API.
The single source of panel sizes (left β 40, right β 80, top/bottom β 10, resize step β 3). Used by edgy (sizes and resize keymaps) and diffview (the file and history panels) β which keeps the sidebars consistent. Reference β in API.
- extras registration in
:LazyExtras - use of
LazyVim.*utilities (has_extra,root,lualine.pretty_path,pick) - extending LazyVim's options through specs
- everything plugs in through specs and
import optional = trueβ degradation without errorscond/enabledβ conditional loading
- chezmoi β
chezmoi addfor the lock files after:Lazy update - VSCode β a mode for vscode-neovim (the mode indicator, adjusted keymaps)
- The system β the OS theme (macOS
defaults/ Linuxgsettings), signals for theme switching,trashandopenin neo-tree
- extras that aren't enabled don't exist as code: the registry is just an
importlist - almost every plugin is lazy: events (
VeryLazy,BufReadPre), commands, keymaps - the
perf.*extras add housekeeping: stopping inactive LSPs, closing old buffers
A file in the appropriate category:
-- lua/lazyvimx/extras/<category>/<name>.lua
return {
"author/plugin.nvim",
desc = "A description for :LazyExtras",
opts = { ... },
}And a line in the extras/core/extras.lua registry:
{ import = "lazyvimx.extras.<category>.<name>" },A file in an overrides/ category β picked up automatically when the category is imported:
-- lua/lazyvimx/overrides/other/my-override.lua
return {
"plugin/name",
optional = true,
opts = { ... },
}" Loaded spec modules
:lua vim.print(require("lazy.core.config").spec.modules)
" The current lazyvimx config
:lua vim.print(require("lazyvimx").config)
" Load profiling
:Lazy profile