# Vimrc / init.lua Structure Standards
## Rule
All Neovim configurations MUST follow a modular Lua structure with logical separation of concerns. No monolithic init.lua files exceeding 200 lines.
## Format
```
~/.config/nvim/
├── init.lua # Bootstrap only (< 30 lines)
├── lua/
│ ├── config/
│ │ ├── options.lua # vim.opt settings
│ │ ├── keymaps.lua # Key mappings
│ │ └── autocmds.lua # Autocommands
│ └── plugins/
│ ├── telescope.lua # One file per plugin
│ ├── lsp.lua
│ ├── completion.lua
│ └── treesitter.lua
└── lazy-lock.json # Committed to Git
```
## Requirements
### init.lua (Bootstrap Only)
```lua
-- Good: minimal bootstrap
vim.g.mapleader = " "
require("config.options")
require("config.keymaps")
require("config.autocmds")
-- Bootstrap lazy.nvim and load plugins/
```
### Plugin Specs (One Per File)
```lua
-- Good: lua/plugins/telescope.lua
return {
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
keys = { { "<leader>ff", "<cmd>Telescope find_files<cr>" } },
opts = { ... },
}
```
### Bad
```lua
-- Bad: 500-line init.lua with everything mixed together
vim.opt.number = true
-- ... 200 lines of options ...
require("telescope").setup({ ... })
-- ... 200 lines of plugin configs ...
vim.keymap.set("n", "<leader>ff", ...)
-- ... 100 lines of keymaps ...
```
## Enforcement
- init.lua must be under 30 lines
- Each plugin file must contain exactly one `return` statement
- Options, keymaps, and autocmds live in separate files under config/
- lazy-lock.json must be committed to version control