5.0 KiB
5.0 KiB
AGENTS: Neovim Config Migration
Scope: applies to the entire ~/.config/nvim directory tree.
This repository is being migrated to a modern, minimal Neovim setup driven by Lua and lazy.nvim. Follow these rules when making changes.
Goals
- Modern Lua-first config; avoid Vimscript unless explicitly requested.
- Keep it minimal, fast, and maintainable.
- Base plugin management on
lazy.nvimwith modular plugin specs. - Support tab-per-context workflow with Neo-tree per tab, Telescope navigation, LSP, Treesitter, Copilot, and sane UX defaults.
Do Not Reintroduce
- Custom Vimscript tabline/statusline, foldtext, UI hacks.
- Legacy autocommands toggling cursorline/column per window.
- CoC or CoC-specific config.
- netrw settings (Neo-tree will be used).
- Providers for ruby/perl/node (disable unless required by a plugin).
- Auto-reload vimrc-on-write templates.
cursorcolumnand old folding logic not related to UFO.
Repository Structure (target)
~/.config/nvim/
├── init.lua -- entrypoint; bootstraps lazy.nvim and loads Lua modules
└── lua/
├── settings.lua -- non-plugin options
├── keymaps.lua -- non-plugin keymaps
├── autocmds.lua -- non-plugin autocommands
├── utils.lua -- helpers (only if needed)
└── plugins/ -- one file per plugin or domain
├── neo-tree.lua
├── telescope.lua
├── treesitter.lua
├── cmp.lua
├── lsp.lua
├── copilot.lua
├── ufo.lua
├── gitsigns.lua
├── markdown.lua
└── none-ls.lua
Coding Conventions
- Use Lua APIs:
vim.opt,vim.api.nvim_create_autocmd,vim.keymap.set. - No inline Vimscript or
vim.cmdblocks unless strictly necessary. - Keep plugin configuration self-contained in its plugin spec file.
- Prefer small, readable modules and minimal configuration over heavy customization.
- Keymaps: use
vim.keymap.setwith{ silent = true, noremap = true }defaults unless otherwise required. - Autocommands: group via
vim.api.nvim_create_augroupand create specific, narrowly scoped autocmds. - Avoid global state; return tables from modules and plugin specs.
Plugin Management (lazy.nvim)
- Each plugin lives in
lua/plugins/<name>.luaand returns a spec table. - Use
opts = {}for default options andconfig = function(_, opts) ... endfor setup. - Only include plugins listed in the migration guide unless explicitly approved.
Required Plugin Categories
- Core:
nvim-lspconfig,nvim-cmp,cmp-nvim-lsp,cmp-buffer,cmp-path,LuaSnip. - Navigation:
neo-tree.nvim,telescope.nvim(+ optionaltelescope-fzf-native.nvim). - Treesitter:
nvim-treesitter,nvim-treesitter-textobjects,nvim-ts-autotag. - UX/Editing:
Comment.nvim,surround.nvim,nvim-autopairs,indent-blankline.nvim,leap.nvimorflash.nvim,nvim-ufo,undotree(optional). - Git:
gitsigns.nvim. - Markdown:
render-markdown.nvim. - Copilot:
copilot.lua,copilot-cmp. - Formatting:
none-ls.nvim.
Workflow Requirements to Preserve
- Tab-per-context: each tab has its own Neo-tree root.
- Provide keymaps for: Neo-tree floating, Neo-tree sidebar toggle, and file preview. Previews should not pollute buffer list.
- Keep splits inside tabs.
- Use Telescope and LSP for navigation.
- Heavy HTML/PHP/JS/Markdown usage (WordPress plugin dev) — prioritize these languages in LSP/Treesitter.
Behaviours to Keep (modernized)
- Abbreviations:
adn→and,waht→what,tehn→then,functin→function,positin→position. - Templates: auto-populate
.shfrom template. - Whitespace highlighting (use modern alternatives, e.g.,
listchars, plugins if needed). - Persistent folds (prefer
nvim-ufo). - Spell & text:
spelllang=en_gb, customlistchars,showbreak.
Migration Notes
- Do not edit legacy Vimscript files except to extract settings to Lua. Keep them intact until migration completes.
- Introduce
init.luaand bootstraplazy.nvimbefore adding plugins. - Disable unnecessary providers early:
vim.g.loaded_ruby_provider = 0, etc. - Keep startup fast; avoid unnecessary autoloading or heavy defaults.
- When cleaning, archive existing files into a
legacy/folder within this config instead of deleting. Maintain a brief index if helpful.
Validation
- Ensure Neovim starts without errors and with minimal startup time.
- Verify tab workflow, Neo-tree behaviour, Telescope, LSP basics, and completion.
- Keep plugin count tight; remove anything unused.
Process
- Before large changes, update the task plan via the CLI
update_plantool. - Keep the live checklist in
MIGRATION_PLAN.md:1up to date and in sync with changes. - At the start of each phase, confirm scope and priorities for that phase.
- Keep PR-sized patches; avoid broad unrelated edits.
- Document non-obvious choices in commit messages or short comments near the code that needs it.