[BUG] iTerm2 keybinding for shift+enter breaks shift+enter in other programs running in iTerm2
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:
- perform terminal setup via
claude, or run the above setup command directly - launch
nvim - press
:to enter command mode - type
imap <S-Enter> helloand press enter - press
ito enter insert mode - press shift+enter
- notice a new line is added, while "hello" should have been inserted into the buffer
- remove the iTerm2 keybinding (Settings -> Keys -> Key Bindings)
- press shift+enter
- notice "hello" is inserted into the buffer
Reproduce with Yazi:
- perform terminal setup via
claude, or run the above setup command directly - launch
yazi - select a file by pressing space
- press shift+enter (this keybinding is a default one, documented here https://yazi-rs.github.io/docs/quick-start)
- notice the file is opened immediately in a default associated program (
$EDITOR) - remove the iTerm2 keybinding (Settings -> Keys -> Key Bindings)
- press shift+enter
- 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.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗