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

Status Closed — not planned
Maintainer reply None cached
Activity 6 comments · opened Mar 25, 2025 · 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 ↗

6 Comments

moodiRealist · 1 year ago

Any updates on this bug plz? 🙏 iterm2 key bindings become useless after installing claude!

github-actions[bot] · 10 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

ku1ik · 10 months ago

Still occuring.

github-actions[bot] · 9 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

ku1ik · 9 months ago

Still an issue.

github-actions[bot] · 9 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.