Skip to content

Commit 38472fe

Browse files
committed
docs: add Neovim agent guides and update utils style
1 parent 0a57e47 commit 38472fe

File tree

7 files changed

+97
-1
lines changed

7 files changed

+97
-1
lines changed

.config/nvim/AGENTS.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Neovim Configuration - Agent Guide
2+
3+
Neovim config with Lazy.nvim, Lua-first modules, and VSCode-mode support.
4+
5+
## Essentials
6+
7+
- Lazy.nvim plugin system is bootstrapped in `lua/config/lazy.lua`.
8+
- Plugin specs live under `lua/plugins/` and are imported via `lua/plugins/init.lua`.
9+
- VSCode mode (`vim.g.vscode`) loads `lua/config/vscode.lua` and disables most UI plugins.
10+
- Neovim state lives in `.config/nvim/.undo`, `.backup`, `.sessions`, `.swp` (do not edit directly).
11+
12+
## More Guidance
13+
14+
- [Local structure and entrypoints](docs/agents/structure.md)
15+
- [Options, autocmds, and keymaps](docs/agents/behavior.md)
16+
- [User commands and utils](docs/agents/utils.md)
17+
- [Plugin layout](docs/agents/plugins.md)
18+
- [VSCode mode](docs/agents/vscode.md)
19+
- [Lua style (shared)](../../docs/agents/nvim-lua.md)
20+
- [File organization (shared)](../../docs/agents/file-organization.md)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Options, Autocmds, and Keymaps
2+
3+
Options highlights:
4+
5+
- Spellcheck is deferred to text-heavy filetypes (see `config.autocmd`).
6+
- State dirs: `.undo`, `.backup`, `.swp`, `.sessions` under `stdpath("config")`.
7+
- Filetype and syntax are disabled early for startup (re-enabled by plugins).
8+
9+
Autocmds:
10+
11+
- Filetype overrides: JSON5, MDX.
12+
- Spell on for text filetypes (unless VSCode).
13+
- Relative number toggled by insert/normal state.
14+
- `checktime` on focus/enter, notify on external changes.
15+
16+
Keymaps:
17+
18+
- Base maps are loaded from `config.keymaps.*`.
19+
- Plugin maps load on `VeryLazy` to avoid heavy startup.
20+
- Use `utils.set_keymap` for consistency.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Plugin Layout
2+
3+
Lazy.nvim setup lives in `lua/config/lazy.lua`.
4+
5+
Plugin categories:
6+
7+
- `ai/`
8+
- `core/`
9+
- `lang/`
10+
- `misc/`
11+
- `ui/`
12+
- `workflow/`
13+
14+
Plugins are aggregated via `lua/plugins/init.lua` and further composed by category.
15+
16+
Built-in plugins disabled in `config.lazy` include netrw, tar/zip, tutor, matchit, matchparen, and others.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Local Structure and Entrypoints
2+
3+
Entrypoint flow:
4+
5+
- `.config/nvim/init.lua` sets leaders and loads `config`
6+
- `lua/config/init.lua` loads core modules in order
7+
8+
Core modules:
9+
10+
- `config.opts`: options and defaults
11+
- `config.usercmd`: user commands via `utils.set_usrcmd`
12+
- `config.keymaps`: base keymaps + deferred plugin keymaps
13+
- `config.autocmd`: filetype rules, spell, UI behaviors
14+
- `config.abbr`: filetype abbreviations and typo fixes
15+
- `config.lazy`: Lazy.nvim bootstrap
16+
17+
Plugin loading:
18+
19+
- `lua/plugins/init.lua` imports plugin categories
20+
- UI/lang/workflow/ai are disabled in VSCode mode

.config/nvim/docs/agents/utils.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# User Commands and Utils
2+
3+
User commands:
4+
5+
- `DiffClip`: compare active buffer with clipboard
6+
- `WipeAllSessions`: removes sessions in `.config/nvim/.sessions`
7+
- `Z`: `wa | qa` shortcut
8+
9+
Utils:
10+
11+
- `utils.set_keymap(mode, lhs, rhs, opts_or_desc)` for keymaps
12+
- `utils.set_usrcmd(cmd, callback, opts_or_desc)` for user commands
13+
- `utils.wipe_all_sessions()` for session cleanup

.config/nvim/docs/agents/vscode.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# VSCode Mode
2+
3+
When `vim.g.vscode` is set:
4+
5+
- `config.vscode` replaces notifications and maps VSCode actions.
6+
- UI/lang/workflow/ai plugin categories are disabled.
7+
- Spellcheck and other behaviors respect VSCode guard clauses.

.config/nvim/lua/utils/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function M.load_highlights(group)
77
end
88

99
function M.set_usrcmd(cmd, callback, opts_or_desc)
10-
opts = opts or {}
10+
local opts = opts or {}
1111
vim.api.nvim_create_user_command(
1212
cmd,
1313
callback,

0 commit comments

Comments
 (0)