Keybindings: expose vim-mode contexts (VimNormal / VimInsert) for mode-aware key bindings

Resolved 💬 2 comments Opened May 22, 2026 by guyzmo Closed May 25, 2026

Summary

When vim mode is enabled, the keybinding system has no way to distinguish between normal mode and insert mode. All Chat context bindings apply regardless of the current vim state, making it impossible to assign different actions to the same key depending on mode.

Desired behaviour

A common and ergonomic configuration would be:

| Mode | Key | Action |
|------|-----|--------|
| Insert | Enter | chat:newline (insert a line break) |
| Normal | Enter | chat:submit (send the message) |

This matches the mental model vim users already have: you compose text in insert mode and execute actions in normal mode.

Proposed solution

Expose two additional keybinding contexts:

VimNormal   — active when vim mode is on and the editor is in normal mode
VimInsert   — active when vim mode is on and the editor is in insert mode

With these contexts, the configuration above would be expressed as:

{
  "$schema": "https://www.schemastore.org/claude-code-keybindings.json",
  "$docs": "https://code.claude.com/docs/en/keybindings",
  "bindings": [
    {
      "context": "Chat",
      "bindings": {
        "enter": null
      }
    },
    {
      "context": "VimInsert",
      "bindings": {
        "enter": "chat:newline"
      }
    },
    {
      "context": "VimNormal",
      "bindings": {
        "enter": "chat:submit"
      }
    }
  ]
}

Current workaround

Use ctrl+j (the existing chat:newline default) for line breaks in insert mode. This works but is non-obvious for vim users who expect Enter to insert a newline when composing.

Context

  • Claude Code version: latest
  • Vim mode: enabled
  • Platform: macOS (darwin)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗