claude-code - 💡(How to fix) Fix Feature Request: Vim insert mode key remapping (imap equivalent)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

Current Workaround Attempted

Setting a keybinding chord in ~/.claude/keybindings.json:

{
  "context": "Chat",
  "bindings": {
    "f d": "chat:cancel"
  }
}

Code Example

{
  "context": "Chat",
  "bindings": {
    "f d": "chat:cancel"
  }
}

---

{
  "editorMode": "vim",
  "vimMappings": {
    "insert": {
      "fd": "<Esc>",
      "jk": "<Esc>"
    }
  }
}

---

{
  "context": "Chat.VimInsert",
  "bindings": {
    "f d": "vim:exitInsertMode"
  }
}
RAW_BUFFERClick to expand / collapse

Feature Request: Vim Insert Mode Key Remapping in Chat Input

Problem

Currently, Claude Code supports editorMode: "vim" which enables vim keybindings in the chat input. However, the keybinding system (~/.claude/keybindings.json) cannot customize vim mode transitions, particularly mapping key sequences to escape insert mode.

Users with muscle memory from vim/neovim commonly use sequences like fd, jk, or jj as alternatives to Escape for exiting insert mode (via :imap fd <Esc> in vim). This muscle memory doesn't transfer to Claude Code.

Current Workaround Attempted

Setting a keybinding chord in ~/.claude/keybindings.json:

{
  "context": "Chat",
  "bindings": {
    "f d": "chat:cancel"
  }
}

Issues with this approach:

  1. Blocks normal typing of the first key ('f' waits for chord completion)
  2. chat:cancel is not the same as "exit vim insert mode"
  3. The keybinding system operates at a different level than vim mode

Proposed Solution

Add vim-specific configuration options, similar to neovim's :imap, :nmap, etc. For example:

Option 1: Dedicated vim section in settings.json

{
  "editorMode": "vim",
  "vimMappings": {
    "insert": {
      "fd": "<Esc>",
      "jk": "<Esc>"
    }
  }
}

Option 2: Extend keybindings.json with vim contexts

{
  "context": "Chat.VimInsert",
  "bindings": {
    "f d": "vim:exitInsertMode"
  }
}

Use Case

As a vim user with inoremap fd <Esc> in my .vimrc/init.lua, I want the same mapping in Claude Code's chat input so I can use consistent muscle memory across all my editing environments.

Alternatives Considered

  • Using native Escape key (works but breaks muscle memory)
  • System-wide key remapping tools (too broad, affects all applications)

Related

This would align Claude Code's vim mode with standard vim/neovim customization capabilities and improve the experience for vim power users.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING