4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WindowsTerminal上のClaude Codeで、Shift+Enterを送信でなく改行にする

4
Last updated at Posted at 2026-04-30

Windows Terminal上で、Claude Codeを動かすと、デフォルト設定のままでは、Shift+Enterで改行にならずに送信されます。現時点(2026年4月末)では、公式ドキュメントにもその対応方法がないようなので、その対応方法を記載しておきます。
主に、WSL2+UbuntuでClaude Codeを使用することを想定しています。

テスト環境

OS:Windows11 Pro 25H2
ターミナルソフトウェア:Windows Terminal v1.24.10921 および Windows Terminal Preview v1.25.1171
WSL 2.6.3
WSL2上のOS: Ubuntu 24.04.4 LTS
マルチプレクサ: tmux 3.6a

問題点

Claudeや、ChatGPTなどをブラウザでプロンプトを入力している時には、Enterキーで送信、Shift+Enterキーで改行となります。複数行のプロンプトを入力する時には、Shift+Enterキーで改行していって、最後にEnterキーでプロンプトを送信する操作になります。
ところが、Windows Terminal上で、WSL+Ubuntu環境などで、Claude Codeでプロンプトを入力する時には、デフォルトの設定のままだと、Shift+Enterキーでも送信されてしまいます。Alt+Enterキーで改行になるのですが、ブラウザと違うのは非常に使いにくいので同じに設定しようと考えました。

対応方法

Windows Terminalnのsettings.jsonに以下のように設定します。
これはsettings.jsonの抜粋で、actionsと、keybindingsのセクションに追加するものです。idのUser.sendInput.999999はjson内でユニークな適当な文字列です。

    "actions": [
        {
            "command":
            {
                "action": "sendInput",
                "input": "\u001b[13;2u"
            },
            "id": "User.sendInput.999999"
        }
    ],
    "keybindings": 
    [
        ....,
        {
            "id": "User.sendInput.999999",
            "keys": "shift+enter"
        }
    ],

要は、Shift+Enterキーで、ESC + [13;2uを送信するということです。
この送信文字列は、kittyキーボードプロトコルによる、Shift + Enterキーの入力を表すエスケープシーケンスです。

設定の詳細ドキュメントは以下

tmuxでの対応

さらに、Ubuntu上でtmuxを使用する時は、設定ファイル.tmux.confに、

set -s extended-keys always
set -as terminal-features '*:extkeys'

を追加して拡張コードを通過させるようにしてください。
(これがないと、Shift+Enterで改行になりませんでした)

補足

Claude Codeの公式ドキュメントのtmux部分
https://code.claude.com/docs/ja/terminal-config#tmux-を設定する
では

set -g allow-passthrough on

の設定があり、必要そうですが、こちらは未検証です。

注意

・kitty対応は、Windows Terminal v1.25以降なので、これより以前のバージョンでは動作しないと思っていたのですが、検証するとなぜか v1.24でも動きます。
・しばらくすると、公式ドキュメントなどにも説明が載ると思いますので、その時はそちらをご参照ください。
(*).ちなみに、現時点(2026年4月末)の公式ドキュメント
https://code.claude.com/docs/ja/terminal-config
では、Windows Terminalでは利用不可になっていますね。
(*).2026年8月末に再確認すると、Windows TerminalではセットアップなしでOKになっていますが、Windows Terminal v1.24でテストすると動きませんでした。そのため、しばらくは本記事の設定が必要そうです。

4
1
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
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?