Use an editable symlink so Vim loads your working tree directly:
mkdir -p ~/.vim/pack/dev/start
ln -s /path/to/codex-vim9 ~/.vim/pack/dev/start/codex-vim9Inside Vim or MacVim, reload the plugin with:
:CodexReloadplugin/codex_vim.vim: the plugin implementationdoc/codex_vim.txt: Vim helptest/*.vim: headless Vim teststest/capture_codex.py,test/tool_server.py: fake Codex servers for deterministic tests
The plugin is a single Vim9 script that:
- starts
codex app-serverover stdio - initializes with
capabilities.experimentalApi = true - persists one thread id per scope under the state dir
- builds JSON editor context from the current buffer, selection, and surrounding lines
- handles both ordinary turn responses and dynamic tool calls
vim_normal is always registered on new threads. Per-turn gating is enforced locally:
:CodexShowdisables tool use for that turn:CodexShowToolenables tool use for that turn- if Codex calls the tool while disabled, the plugin returns a tool error
Run the offline suite:
./test.shCurrent offline coverage:
smoke_basic: command load/reload and basic startupcursor_context: prompt context JSON shapetool_gate: tool registration, enabled path, rejected path, and undo behavior
Run the live roundtrip only when the change plausibly affects the real Codex path:
./test.sh live_apply- Keep tests focused and deterministic. Prefer fake app-server helpers over brittle UI tests.
- Use
apply_patchfor edits. - Update
README.mdanddoc/codex_vim.txtwhen behavior changes. - Run
chkstyleafter editing Python test helpers.