Fork: Configuration

Configuration

TUI settings belong in ~/.config/ocv/cli.json. XDG_CONFIG_HOME and OPENCODE_CONFIG_DIR can override the config location.

Options

OptionPurpose
prompt_max_heightSet max prompt input height
prompt_scrollbarShow the prompt scrollbar
diffs.commandRun an external viewer for /diff
vim_initial_modeStart in insert (default) or normal
vim_enter_submitSubmit with Enter from insert mode
vim_insert_after_submitReturn to insert mode after submit
vim_system_clipboard_registerUse the system clipboard as Vim register
vim_modal_inputEnable Vim controls in dialogs
vim_langmapMap non-English keys or simple aliases
vim_line_motionsUse wrapped display-line motions
vim_showbreakMark wrapped prompt rows
vim_escape_sequenceUse a two-key escape sequence like jk

Initial mode

Vim mode starts in insert mode by default. To start in normal mode instead:

{
  "vim_initial_mode": "normal"
}

Mode-scoped keybinds

Bind existing commands only in normal mode by nesting overrides under vim.normal.

For example, use <space> as the leader:

{
  "keybinds": {
    "vim.normal": {
      "leader": "space",
      "session.list": "<leader>s"
    }
  }
}

When vim.normal.leader is set without a top-level leader, it replaces the implicit default global leader (Ctrl+X). Configure both to keep both leaders.

Prompt input height

Configure prompt input height in cli.json:

{
  "prompt_max_height": 35,
  "prompt_scrollbar": true
}

prompt_max_height above 40 is not recommended.

Submit behavior

By default, insert mode uses Enter for newlines and normal mode uses Enter to submit.

To submit from insert mode too:

{
  "vim_enter_submit": true
}

To always default to insert mode after a prompt submission:

{
  "vim_insert_after_submit": true
}

To keep newline available:

{
  "keybinds": {
    "input.newline": "alt+return"
  }
}

Or configure a separate direct-submit key:

{
  "keybinds": {
    "prompt.submit": "alt+return"
  }
}

prompt.submit is unbound by default.

System clipboard register

Use the system clipboard as Vim's register:

{
  "vim_system_clipboard_register": true
}

Yank and delete operations sync to the system clipboard, p / P paste from it.

Disable modal controls in searchable dialogs, prompt dialogs, and custom question answer inputs:

{
  "vim_modal_input": false
}

Note

Terminal/OS clipboard shortcuts don’t preserve Vim linewise register state. External clipboard text is pasted as characterwise text.

Vim langmap

Map non-English keyboard layout characters to Vim command keys.

Keys and values should be single characters.

{
  "vim_langmap": {
    "р": "h",
    "о": "j",
    "л": "k",
    "д": "l"
  }
}

Or or for simple aliases:

{
  "vim_langmap": {
    "H": "^",
    "L": "$"
  }
}

Vim line motions

Choose how motions handle wrapped lines in the prompt:

{
  "vim_line_motions": "logical"
}

Values:

ValueBehavior
logicalVertical and boundary motions use logical lines
display_verticalVertical motions use display lines; boundaries stay logical
displayVertical and boundary motions use display lines

Vim showbreak

Set a marker for wrapped rows in the prompt:

{
  "vim_showbreak": true
}

Shows ↪ marker in the prompt's left padding.

Vim escape sequence

Set a two-character sequence to leave insert mode without pressing Escape:

{
  "vim_escape_sequence": "jk"
}

External diff viewer

Open /diff with an external viewer, such as Diffview.nvim:

{
  "diffs": {
    "command": ["nvim", "-c", "DiffviewOpen"]
  },
  "keybinds": {
    "vim.normal": {
      "diff.open": "<leader>d"
    }
  }
}

Minimal UI

Hides extra UI hints and tips.

Toggle via command palette > Toggle minimal ui.