[BUG] iTerm2 keybinding for shift+enter breaks shift+enter in other programs running in iTerm2

Resolved 💬 6 comments Opened Mar 25, 2025 by ku1ik Closed Jan 5, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other:
  • Claude CLI version: 0.2.53 (Claude Code)
  • Operating System: macOS 15.3.2
  • Terminal: iTerm2 3.5.11

Bug Description

The terminal setup command, which installs a keybinding for Shift+Enter in iTerm2 config breaks Shift+Enter in other terminal programs, such Neovim, yazi, helix editor.

Claude Code runs the following command to install the Shift+Enter keybinding:

defaults write com.googlecode.iterm2 GlobalKeyMap -dict-add 0xd-0x20000-0x24 '<dict><key>Text</key><string>\\n</string><key>Action</key><integer>12</integer><key>Version</key><integer>1</integer><key>Keycode</key><integer>13</integer><key>Modifiers</key><integer>131072</integer></dict>'

Steps to Reproduce

Reproduce with Neovim:

  1. perform terminal setup via claude, or run the above setup command directly
  2. launch nvim
  3. press : to enter command mode
  4. type imap <S-Enter> hello and press enter
  5. press i to enter insert mode
  6. press shift+enter
  7. notice a new line is added, while "hello" should have been inserted into the buffer
  8. remove the iTerm2 keybinding (Settings -> Keys -> Key Bindings)
  9. press shift+enter
  10. notice "hello" is inserted into the buffer

Reproduce with Yazi:

  1. perform terminal setup via claude, or run the above setup command directly
  2. launch yazi
  3. select a file by pressing space
  4. press shift+enter (this keybinding is a default one, documented here https://yazi-rs.github.io/docs/quick-start)
  5. notice the file is opened immediately in a default associated program ($EDITOR)
  6. remove the iTerm2 keybinding (Settings -> Keys -> Key Bindings)
  7. press shift+enter
  8. notice yazi displays "Open with" popup, as expected

Expected Behavior

Claude Code's terminal setup doesn't break Shift+Enter behavior in other terminal programs.

Actual Behavior

Claude Code's terminal setup breaks Shift+Enter behavior in other terminal programs.

Additional Context

Neovim, Yazi, and increasing number of CLI programs use Kitty keyboard protocol for advanced keyboard shortcuts. By mapping Shift+Enter to "\n" (what you do here) you're preventing actual Shift+Enter sequence (kitty protocol encoded) from hitting any program running in iTerm2. I strongly suggest using a different approach for claude under iTerm2.

View original on GitHub ↗

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