[BUG] Custom keybindings aren't picked up on first run
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When you first launch Claude Code in a completely fresh environment, no custom keybindings are available and the /keybindings build-in command doesn't appear until you close Claude and relaunch it.
What Should Happen?
When you launch Claude Code in a completely fresh environment, keybindings should already be configured based on ~/.claude/keybindings.json and the /keybindings built-in command should be immediately available.
Error Messages/Logs
~ $ docker run -it --rm ubuntu:24.04
root@251c67f2480b:/# source /dev/stdin <<'EOF'
mkdir ~/.claude
cat > ~/.claude/keybindings.json <<'EOF2'
{
"$schema": "https://www.schemastore.org/claude-code-keybindings.json",
"$docs": "https://code.claude.com/docs/en/keybindings",
"bindings": [
{
"context": "Global",
"bindings": {
"ctrl+q": "chat:modelPicker"
}
}
]
}
EOF2
apt update &>/dev/null
apt install -y curl nano &>/dev/null
curl -fsSL https://claude.ai/install.sh | bash &>/dev/null
export PATH=$HOME/.local/bin:$PATH
export EDITOR=nano
EOF
root@251c67f2480b:/# claude
╭─── Claude Code v2.1.71 ────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back Eddie Nolan! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ │ Recent activity │
│ ▐▛███▜▌ │ No recent activity │
│ ▝▜█████▛▘ │ │
│ ▘▘ ▝▝ │ │
│ Opus 4.6 · Claude Max · eddiejnolan@gmail.com's │ │
│ Organization │ │
│ / │ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
❯ Unknown skill: keybindings
❯ /exit
⎿ Bye!
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
? for shortcuts
Resume this session with:
claude --resume 2fbe71a2-7e7f-4595-9204-add70cf8c724
root@251c67f2480b:/# claude
╭─── Claude Code v2.1.71 ────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back Eddie Nolan! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ │ Recent activity │
│ ▐▛███▜▌ │ No recent activity │
│ ▝▜█████▛▘ │ │
│ ▘▘ ▝▝ │ │
│ Opus 4.6 · Claude Max · eddiejnolan@gmail.com's │ │
│ Organization │ │
│ / │ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✻ Voice mode is now available · /voice to enable
❯ /keybindings
⎿ Opened /root/.claude/keybindings.json in your editor.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Select model
Switch between Claude models. Applies to this session and future Claude Code sessions. For other/previous model names, specify with --model.
❯ 1. Default (recommended) ✔ Opus 4.6 · Most capable for complex work
2. Sonnet Sonnet 4.6 · Best for everyday tasks
3. Haiku Haiku 4.5 · Fastest for quick answers
▌▌▌ Medium effort (default) ← → to adjust
Enter to confirm · Esc to exit
Steps to Reproduce
Launch a fresh Docker image:
~ $ docker run -it --rm ubuntu:24.04
Run commands to set up Claude Code and create a keybinding configuration file that maps ctrl+q to open the model picker:
root@251c67f2480b:/# source /dev/stdin <<'EOF'
mkdir ~/.claude
cat > ~/.claude/keybindings.json <<'EOF2'
{
"$schema": "https://www.schemastore.org/claude-code-keybindings.json",
"$docs": "https://code.claude.com/docs/en/keybindings",
"bindings": [
{
"context": "Global",
"bindings": {
"ctrl+q": "chat:modelPicker"
}
}
]
}
EOF2
apt update &>/dev/null
apt install -y curl nano &>/dev/null
curl -fsSL https://claude.ai/install.sh | bash &>/dev/null
export PATH=$HOME/.local/bin:$PATH
export EDITOR=nano
EOF
Launch claude for the first time, sign in, and notice that the /keybindings command is unavailable, and the ctrl+q keybinding isn't bound to the model picker:
root@251c67f2480b:/# claude
╭─── Claude Code v2.1.71 ────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back Eddie Nolan! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ │ Recent activity │
│ ▐▛███▜▌ │ No recent activity │
│ ▝▜█████▛▘ │ │
│ ▘▘ ▝▝ │ │
│ Opus 4.6 · Claude Max · eddiejnolan@gmail.com's │ │
│ Organization │ │
│ / │ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
❯ Unknown skill: keybindings
❯ /exit
⎿ Bye!
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
? for shortcuts
Resume this session with:
claude --resume 2fbe71a2-7e7f-4595-9204-add70cf8c724
Launch claude a second time, notice that /keybindings is available and works, and that ctrl+q brings up the model picker as configured:
root@251c67f2480b:/# claude
╭─── Claude Code v2.1.71 ────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back Eddie Nolan! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ │ Recent activity │
│ ▐▛███▜▌ │ No recent activity │
│ ▝▜█████▛▘ │ │
│ ▘▘ ▝▝ │ │
│ Opus 4.6 · Claude Max · eddiejnolan@gmail.com's │ │
│ Organization │ │
│ / │ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✻ Voice mode is now available · /voice to enable
❯ /keybindings
⎿ Opened /root/.claude/keybindings.json in your editor.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Select model
Switch between Claude models. Applies to this session and future Claude Code sessions. For other/previous model names, specify with --model.
❯ 1. Default (recommended) ✔ Opus 4.6 · Most capable for complex work
2. Sonnet Sonnet 4.6 · Best for everyday tasks
3. Haiku Haiku 4.5 · Fastest for quick answers
▌▌▌ Medium effort (default) ← → to adjust
Enter to confirm · Esc to exit
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.71
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗