経緯
DevContainer環境でClaudeCodeを利用している。
VSCodeでClaudeCodeを立ち上げてプロンプト入力する際、複数行に分けて入力したかったがShft+Enterしたところ、そのままプロンプト送信されてしまった。
IntelliJやZedではShft+Enterが使えていたので、VSCodeのツール設定等で対応できるはず。
前提
Claude公式ドキュメント:https://code.claude.com/docs/ja/terminal-config
を見たところ、ローカルマシン上でClaudeCodeを利用している場合は、claude 起動後に
/terminal-setup
すれば自動で設定してくれることがわかった。べんり。
問題
今回はDevContainer環境でローカルホストからのリモート接続になるため /terminal-setup での自動設定ができず、エラーが出てしまった。
❯ /terminal-setup
⎿ Cannot install keybindings from a remote VSCode session.
VSCode keybindings must be installed on your local machine, not the remote server.
To install the Shift+Enter keybinding:
1. Open VSCode on your local machine (not connected to remote)
2. Open the Command Palette (Cmd/Ctrl+Shift+P) → "Preferences: Open Keyboard Shortcuts (JSON)"
3. Add this keybinding (the file must be a JSON array):
[
{
"key": "shift+enter",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b\r" },
"when": "terminalFocus"
}
]
For smoother scrolling, set "terminal.integrated.mouseWheelScrollSensitivity": 3 in VSCode settings.
対応
エラーに丁寧に説明がある通りだが、手動でVSCodeの設定ファイルを記述する
- コマンドパレットを開く(
Ctrl+Shift+P) - 「基本設定: キーボード ショートカットを開く (JSON)」を選択する
- JSON配列(
[])の最後に、以下を追記して保存する
{
"key": "shift+enter",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b\r" },
"when": "terminalFocus"
}
保存後、cluade を再起動しなくても、Shift + Enter 改行できるようになった ![]()