Skip to content
Back to search

codex.nvim

SkillWorks with CodexGitHub

OpenAI Codex plugin for Neovim

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/johnseth97--codex-nvim/badge.svg)](/listings/johnseth97--codex-nvim)

HTML

<a href="/listings/johnseth97--codex-nvim"><img src="/api/listings/johnseth97--codex-nvim/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

- Install the `codex` CLI via npm, or mark autoinstall as true in the config function

npm install -g @openai/codex

- Grab an API key from OpenAI and set it in your environment variables: - Note: You can also set it in your `~/.bashrc` or `~/.zshrc` file to persist across sessions, but be careful with security. Especially if you share your config files.

export OPENAI_API_KEY=your_api_key

- Use your plugin manager, e.g. lazy.nvim:

return {
  'kkrampis/codex.nvim',
  lazy = true,
  cmd = { 'Codex', 'CodexToggle' }, -- Optional: Load only on command execution
  keys = {
    {
      '<leader>cc', -- Change this to your preferred keybinding
      function() require('codex').toggle() end,
      desc = 'Toggle Codex popup or side-panel',
      mode = { 'n', 't' }
    },
  },
  opts = {
    keymaps     = {
      toggle = nil, -- Keybind to toggle Codex window (Disabled by default, watch out for conflicts)
      quit = '<C-q>', -- Keybind to close the Codex window (default: Ctrl + q)
    },         -- Disable internal default keymap (<leader>cc -> :CodexToggle)
    border      = 'rounded',  -- Options: 'single', 'double', or 'rounded'
    width       = 0.8,        -- Width of the floating window (0.0 to 1.0)
    height      = 0.8,        -- Height of the floating window (0.0 to 1.0)
    model       = nil,        -- Optional: pass a string to use a specific model (e.g., 'o3-mini')
    autoinstall = true,       -- Automatically install the Codex CLI if not found
    panel       = false,      -- Open Codex in a side-panel (vertical split) instead of floating window
    use_buffer  = false,      -- Capture Codex stdout into a normal buffer instead of a terminal buffer
  },
}```

### Usage:
- Call `:Codex` (or `:CodexToggle`) to open or close the Codex popup or side-panel.
- Map your own keybindings via the `keymaps.toggle` setting.
- To choose floating popup vs side-panel, set `panel = false` (popup) or `panel = true` (panel) in your setup options.
- To capture Codex output in an editable buffer instead of a terminal, set `use_buffer = true` (or `false` to keep terminal) in your setup options.
- Add the following code to show backgrounded Codex window in lualine:

```lua
require('codex').status() -- drop in to your lualine sections

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 72 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Codex Neovim Plugin
  2. <img width="1480" alt="image" src="https://github.com/user-attachments/assets/eac126c5-e71c-4de9-817a-bf4e8f2f6af9" />
  3. ## A Neovim plugin integrating the open-sourced Codex CLI (`codex`)
  4. > Latest version: ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/johnseth97/codex.nvim?sort=semver)
  5. ### Features:
  6. - ✅ Toggle Codex window or side-panel with `:CodexToggle`
  7. - ✅ Optional keymap mapping via `setup` call
  8. - ✅ Background running when window hidden
  9. - ✅ Statusline integration via `require('codex').status()`
  10. ### Installation:
  11. - Install the `codex` CLI via npm, or mark autoinstall as true in the config function
  12. ```bash
  13. npm install -g @openai/codex
  14. ```
  15. - Grab an API key from OpenAI and set it in your environment variables:
  16. - Note: You can also set it in your `~/.bashrc` or `~/.zshrc` file to persist across sessions, but be careful with security. Especially if you share your config files.
  17. ```bash
  18. export OPENAI_API_KEY=your_api_key
  19. ```
  20. - Use your plugin manager, e.g. lazy.nvim:
  21. ```lua
  22. return {
  23. 'kkrampis/codex.nvim',
  24. lazy = true,
  25. cmd = { 'Codex', 'CodexToggle' }, -- Optional: Load only on command execution
  26. keys = {
  27. {
  28. '<leader>cc', -- Change this to your preferred keybinding
  29. function() require('codex').toggle() end,
  30. desc = 'Toggle Codex popup or side-panel',
  31. mode = { 'n', 't' }
  32. },
  33. },
  34. opts = {
  35. keymaps = {
  36. toggle = nil, -- Keybind to toggle Codex window (Disabled by default, watch out for conflicts)
  37. quit = '<C-q>', -- Keybind to close the Codex window (default: Ctrl + q)
  38. }, -- Disable internal default keymap (<leader>cc -> :CodexToggle)
  39. border = 'rounded', -- Options: 'single', 'double', or 'rounded'
  40. width = 0.8, -- Width of the floating window (0.0 to 1.0)
  41. height = 0.8, -- Height of the floating window (0.0 to 1.0)
  42. model = nil, -- Optional: pass a string to use a specific model (e.g., 'o3-mini')
  43. autoinstall = true, -- Automatically install the Codex CLI if not found
  44. panel = false, -- Open Codex in a side-panel (vertical split) instead of floating window
  45. use_buffer = false, -- Capture Codex stdout into a normal buffer instead of a terminal buffer
  46. },
  47. }```
  48. ### Usage:
  49. - Call `:Codex` (or `:CodexToggle`) to open or close the Codex popup or side-panel.
  50. - Map your own keybindings via the `keymaps.toggle` setting.
  51. - To choose floating popup vs side-panel, set `panel = false` (popup) or `panel = true` (panel) in your setup options.
  52. - To capture Codex output in an editable buffer instead of a terminal, set `use_buffer = true` (or `false` to keep terminal) in your setup options.
  53. - Add the following code to show backgrounded Codex window in lualine:
  54. ```lua
  55. require('codex').status() -- drop in to your lualine sections
  56. ```
  57. ### Configuration:
  58. - All plugin configurations can be seen in the `opts` table of the plugin setup, as shown in the installation section.
  59. - **For deeper customization, please refer to the [Codex CLI documentation](https://github.com/openai/codex?tab=readme-ov-file#full-configuration-example) full configuration example. These features change quickly as Codex CLI is in active beta development.*

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.