1 min read

How I Got Ctrl+K to Work in VS Code on Windows in the Claude Code REPL

If you're using Claude Code's REPL in VS Code on Windows and Ctrl+K isn't working to clear text from the cursor to the end of line (like it does in bash), here's the quick fix.

The Problem

VS Code intercepts Ctrl+K for its own "chord" keybindings, so it never reaches the terminal/REPL. You get a message about waiting for another key instead of clearing the line.

The Solution

You need to override the keybinding in your User keybindings file (not the read-only Default one).

Step 1: Open the correct file

  • Press Ctrl+Shift+P → type Preferences: Open Keyboard Shortcuts (JSON)
  • Or directly open: code "%APPDATA%\Code\User\keybindings.json"

Step 2: Add this configuration:

  [
    {
      "key": "ctrl+k",
      "command": "-workbench.action.terminal.clear",
      "when": "terminalFocus"
    },
    {
      "key": "ctrl+k",
      "command": "workbench.action.terminal.sendSequence",
      "args": { "text": "\u000b" },
      "when": "terminalFocus"
    }
  ]

Step 3: Save (no restart needed)


Why This Works

The key insight: you need to send the actual control character \u000b, not a command like cls or clear. The REPL uses readline-style keybindings where Ctrl+K is a character sequence, not a shell command.

Now Ctrl+K clears from cursor to end of line, and Ctrl+U clears from cursor to beginning - just like in bash!