Skip to content

Commit 15cee0e

Browse files
Merge pull request #33 from mvanhorn/osc/14-vim-neovim-setup-guide
docs: add Vim/Neovim setup guide
2 parents 51db2f6 + e0fdaa7 commit 15cee0e

2 files changed

Lines changed: 75 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ your-project/
230230

231231
Most config files embed the same instructions directly. OpenCode is the exception — `.opencode/opencode.json` references `.mex/AGENTS.md` instead of embedding content. `mex setup` asks which tool you use and creates the appropriate config.
232232

233+
Neovim users have their own guide: see [docs/vim-neovim.md](docs/vim-neovim.md) for Claude Code, Avante.nvim, Copilot.vim, and generic-plugin setups.
234+
233235
## Contributing
234236

235237
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for setup and guidelines.
@@ -240,4 +242,4 @@ See [CHANGELOG.md](CHANGELOG.md) for release history.
240242

241243
## License
242244

243-
[MIT](LICENSE)
245+
[MIT](LICENSE)

docs/vim-neovim.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Using mex with Vim / Neovim
2+
3+
mex's scaffold is tool-agnostic — any AI plugin that can read a system prompt or config file can use it. This guide covers four common setups.
4+
5+
## 1. Claude Code in Neovim's terminal
6+
7+
Run Claude Code directly inside Neovim. This is the path with the least setup — mex already generates a `CLAUDE.md` that Claude picks up automatically.
8+
9+
```bash
10+
# Inside Neovim:
11+
:term claude
12+
```
13+
14+
Claude Code reads `CLAUDE.md` from the project root, so mex's instructions are applied without any plugin configuration. Run `mex setup` (option 1) once to create `CLAUDE.md`, and you're done.
15+
16+
## 2. Avante.nvim
17+
18+
[Avante.nvim](https://github.com/yetone/avante.nvim) supports a custom system prompt. Point it at `.mex/ROUTER.md` (the file mex uses to route AI tools to the right context):
19+
20+
```lua
21+
require("avante").setup({
22+
system_prompt = function()
23+
local f = io.open(vim.fn.getcwd() .. "/.mex/ROUTER.md", "r")
24+
if not f then return "" end
25+
local content = f:read("*a")
26+
f:close()
27+
return content
28+
end,
29+
})
30+
```
31+
32+
Run `mex setup` with option 8 (None / other) — this keeps `.mex/` populated without copying a tool-specific config.
33+
34+
## 3. Copilot.vim / copilot.lua
35+
36+
GitHub Copilot for Neovim reads `.github/copilot-instructions.md` automatically. mex already supports this via `setup.sh` option 4:
37+
38+
```bash
39+
./setup.sh
40+
# Choose option 4 when prompted
41+
```
42+
43+
No plugin config required — Copilot picks up the file as soon as it exists.
44+
45+
## 4. Generic LSP / any other plugin
46+
47+
Any plugin that accepts a system prompt can be pointed at `.mex/ROUTER.md`. The pattern:
48+
49+
```lua
50+
-- Read the ROUTER once and pass it in as the system prompt
51+
local mex_prompt = table.concat(vim.fn.readfile(".mex/ROUTER.md"), "\n")
52+
```
53+
54+
Then feed `mex_prompt` into whatever field your plugin exposes (system prompt, instructions, custom context, etc).
55+
56+
If the plugin doesn't take a file, paste this line into its system prompt instead:
57+
58+
```text
59+
Read .mex/ROUTER.md in the current working directory and follow its routing instructions.
60+
```
61+
62+
That one line is enough — mex's ROUTER.md handles the rest.
63+
64+
## Verifying your setup
65+
66+
After any of the above, run:
67+
68+
```bash
69+
mex check
70+
```
71+
72+
If the scaffold is wired up correctly, mex will pick up your project state and show any drift between config files.

0 commit comments

Comments
 (0)