0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

DevContainer環境のClaudeCodeでShift + Enter改行する

0
Last updated at Posted at 2026-05-19

経緯

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 改行できるようになった :tada:

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?