Summary
The repo structure is already solid and typical for a Lua-based Neovim config, but a few targeted refactors will improve lazy-loading, maintainability, and clarity:
Key improvements to make:
1. Move plugin runtime code out of plugin/ and into lua/ modules (especially for which-key)
- Files in
plugin/ (like plugin/whichkey.lua) are sourced eagerly by Neovim at startup, even with lazy.nvim. This can break lazy-loading and increase startup time.
- Solution: Create
lua/core/whichkey.lua (or similar module for each plugin with runtime code), move all which-key registration there, and invoke it from the relevant plugin's config in lua/plugins/ui.lua.
- Example:
- Before:
plugin/whichkey.lua runs at startup.
- After:
lua/core/whichkey.lua configured from lazy.nvim’s plugin table.
2. (Optional) Break up autocmds.lua and other core glue files by feature
- As autocmds and core helpers grow, split them into smaller files under
lua/core/autocmds/, and require a single setup module (lua/core/autocmds/init.lua).
3. Move all core helpers and glue (e.g., go_to_plugins.lua, mylazy.lua) under lua/core/ for clarity
4. Move long inline plugin configs (from plugin entries in lua/plugins/) into dedicated config files (lua/plugins/config/*.lua)
- Keeps the plugin list focused and makes testing, linting, and maintenance easier.
5. Remove duplicate mappings and accidental globals
- There are duplicate
<leader>fvt mappings and some M = {} globals that should be local M = {}.
- Use a linter and code search (e.g.,
rg '<leader>fvt', rg '^M = {}') to catch and fix them.
6. Document the intended layout and conventions briefly in README.md
Step-by-step checklist
See assistant comment in this issue for migration examples/samples.
Benefit:
- Ensures true lazy-loading, speeds up startup, and future-proofs config growth for maintainability.
Assignee: @BenGH28
Summary
The repo structure is already solid and typical for a Lua-based Neovim config, but a few targeted refactors will improve lazy-loading, maintainability, and clarity:
Key improvements to make:
1. Move plugin runtime code out of
plugin/and intolua/modules (especially for which-key)plugin/(likeplugin/whichkey.lua) are sourced eagerly by Neovim at startup, even withlazy.nvim. This can break lazy-loading and increase startup time.lua/core/whichkey.lua(or similar module for each plugin with runtime code), move all which-key registration there, and invoke it from the relevant plugin's config inlua/plugins/ui.lua.plugin/whichkey.luaruns at startup.lua/core/whichkey.luaconfigured from lazy.nvim’s plugin table.2. (Optional) Break up
autocmds.luaand other core glue files by featurelua/core/autocmds/, and require a single setup module (lua/core/autocmds/init.lua).3. Move all core helpers and glue (e.g.,
go_to_plugins.lua,mylazy.lua) underlua/core/for clarity4. Move long inline plugin configs (from plugin entries in
lua/plugins/) into dedicated config files (lua/plugins/config/*.lua)5. Remove duplicate mappings and accidental globals
<leader>fvtmappings and someM = {}globals that should belocal M = {}.rg '<leader>fvt',rg '^M = {}') to catch and fix them.6. Document the intended layout and conventions briefly in README.md
Step-by-step checklist
plugin/and into a module, and update lazy.nvim configautocmds.luaintolua/core/autocmds/*go_to_plugins.luaandmylazy.lua) intolua/core/lua/plugins/config/*See assistant comment in this issue for migration examples/samples.
Benefit:
Assignee: @BenGH28