Lightweight Neovim integration for Codex CLI via tmux send-keys or an embedded terminal UI.
- Prompt from Neovim, send to a running Codex CLI pane
- If no Codex CLI pane is found, open a local terminal split
- Visual selection adds file/line context
- Auto-reload buffers when Codex edits files
- Neovim >= 0.8
- Codex CLI available in PATH
tmux(optional, for sending to an existing tmux pane)
{
"dukjjang/codex-cli.nvim",
config = function()
require("codex_cli").setup()
end,
}- Normal mode:
<leader>aaopens a prompt and sends:Context: <current-file>- your prompt on the next line
- Visual mode:
<leader>aadoes the same but includes the selected range:Context: <current-file> lines <start>-<end>- your prompt on the next line
- Optional: set
keymaps.visualto a different key if you want a separate visual-only mapping.
Commands:
:CodexSend:CodexAsk:CodexToggle
require("codex_cli").setup({
tmux = {
command = "codex", -- match process name for pane detection
},
split = {
command = "codex", -- command used to launch Codex CLI
direction = "right", -- "right" or "below"
size = 0.4,
},
keymaps = {
enabled = true,
ask = "<leader>aa",
visual = "<leader>aa",
toggle = "<leader>at",
},
command = "CodexSend",
command_ask = "CodexAsk",
command_toggle = "CodexToggle",
})- Pane detection searches the current tmux session and looks for a
codexprocess in the pane's child process tree. - If no tmux pane is found, Codex CLI starts in a terminal split.
- Buffers auto-reload on focus/enter/cursor hold via
checktime. - Invalid configuration values fall back to defaults and emit a warning once.
- No codex pane found: set
tmux.commandto match the process name you see inps. - Not in tmux: tmux integration is optional; the split terminal still works.