How minhcreator/nvim_from_scratch works
Project type and purpose
• This is a customized Neovim configuration repository (“dotfiles”) written in Lua.
• It leverages the Lazy plugin manager to declare and load a suite of plugins, centralizes configuration in modular files, and provides user-override hooks.
File structure
• Top-level:
• init.lua: the Neovim entrypoint that bootstraps the configuration
• lazy-lock.json: pins versions for Lazy plugin manager
• snippets/: JSON snippet definitions for editor completions
• lua/: contains all Lua modules
• autocmds.lua, custom-cmd.lua, keyBinding.lua, options.lua: core Neovim API glue
• chadrc.lua: “framework” initializer—sets up Lazy and default behavior
• plugins/: plugin declarations (which plugins to install, with minimal inline config)
• userConfigs/: override layers for end-user tweaks to default plugin configs
Main components & their relationships
a. Neovim Core
– The running application, exposes API to Lua modules.
b. Bootstrap Layer
– init.lua calls chadrc.lua.
– chadrc.lua invokes Lazy (lazy.nvim) to:
• Read plugin declarations from lua/plugins/
• Resolve dependencies, version constraints (lazy-lock.json)
c. Configuration Layer
– After plugin load, Lazy triggers config callbacks in lua/configs/
– Plugins get configured (e.g., treesitter, telescope, lualine)
d. User Override Layer
– lua/userConfigs/: loaded after defaults, allows overriding plugin settings
e. Core Glue
– autocmds.lua: autocommands for filetype, events
– custom-cmd.lua: user-defined Ex commands
– keyBinding.lua: global keymaps
– options.lua: Neovim built-in options (clipboard, line numbers, etc.)
f. Snippet Engine
– snippets/*.json: definitions consumed by completion plugin (cmp, luasnip, etc.)
Architectural patterns & design principles
• Modular layering: bootstrap → plugin declaration → default config → user overrides
• Inversion of control: Lazy orchestrates plugin loading and config callbacks
• Separation of concerns:
• Declaration (lua/plugins) vs configuration (lua/configs) vs overrides (lua/userConfigs)
• Core API glue (autocmds, keymaps) isolated from plugin logic