Keybinds · Issue #4997 · anomalyco/opencode · GitHub
Skip to content

Keybinds #4997

Open
13 of 13 issues completed
Open

Description

@rekram1-node

Keybind issues in TUI: broken navigation (ctrl+n/p, ctrl+left/right), word deletion (option+delete, alt+d), multiline input (shift+enter, ctrl+enter), inconsistent emacs bindings (ctrl+a, ctrl+k), custom keybind remapping not working, Windows ctrl+c quits app instead of copy.

Please also consider the docs: https://opencode.ai/docs/keybinds/

Related Issues:

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Dec 2, 2025
  2. pinned this issue on Dec 2, 2025
  3. changed the title [-]Keybinds Discussion[/-] [+]Keybinds[/+] on Dec 2, 2025
  4. mgrachten commented on Dec 2, 2025

    @mgrachten
    Contributor

    Not sure if related, but 1.0.128 is unusable for me because of keyboard woes: Tab as well as Backspace are triggered twice for each press. Effectively I can't switch between Build/Plan mode. Navigation/deletion related keybindings (Alt-b/f, Ctrl-a/e, Ctrl-k, etc) do work for me though.

  5. csinko commented on Dec 2, 2025

    @csinko

    Not sure if related, but 1.0.128 is unusable for me because of keyboard woes: Tab as well as Backspace are triggered twice for each press. Effectively I can't switch between Build/Plan mode. Navigation/deletion related keybindings (Alt-b/f, Ctrl-a/e, Ctrl-k, etc) do work for me though.

    I am also having the double triggering happen and it is driving me crazy! I can't choose sessions anymore (it auto selects the top session), and I cannot tab between build and plan without holding the tab key like spinning the wheel and hoping it lands on the mode I want.

    I am on 1.0.127 right now but I think it started happening to me on Saturday or Sunday.

    I use alacritty 0.14.0 in zsh on MacOS.

  6. mgrachten commented on Dec 3, 2025

    @mgrachten
    Contributor

    I did a bisect on the versions, and the issue @csinko and myself are seeing start with 1.0.120.

  7. 29 remaining items

  8. LIHUA919 commented on Jan 18, 2026

    @LIHUA919

    After analyzing the codebase and recent fixes, here's a technical summary of the keybind issues and their root causes:

    Root Causes Analysis

    1. Kitty Keyboard Protocol Dilemma

    Current Config: useKittyKeyboard: {} (empty object)

    This is a best-effort compromise that:

    • ✅ Avoids doubled key events on older emulators (1.0.120 regression)
    • ❌ Breaks ctrl+m and similar bindings on modern terminals (iTerm2, Kitty)

    The Trade-off:

    // Before (caused doubled events):
    useKittyKeyboard: true  // Full Kitty protocol
    
    // Current (compromise):
    useKittyKeyboard: {}    // Partial, breaks some bindings
    
    // Ideal (not possible yet):
    // Per-terminal auto-detection without regressions

    Why this matters:

    • Kitty protocol allows distinguishing Ctrl+M from Enter
    • Without it, macOS sends \r for both
    • Modern terminals (Kitty, iTerm2) need full protocol
    • Older terminals break with full protocol

    2. Shift+Enter IME Conflict (#8275)

    The Bug: Shift+Enter was blocked during IME composition

    Root Cause:

    // Before (broken):
    if (event.key === "Enter" && isImeComposing(event)) {
      return  // Blocks Shift+Enter\!
    }
    
    if (event.key === "Enter" && event.shiftKey) {
      addPart({ type: "text", content: "\n" })
    }

    Fix: Move Shift+Enter BEFORE IME check

    // After (fixed):
    if (event.key === "Enter" && event.shiftKey) {
      addPart({ type: "text", content: "\n" })  // Always works
      return
    }
    
    if (event.key === "Enter" && isImeComposing(event)) {
      return
    }

    This fixed the v1.1.8 regression reported in comments.

    3. Terminal-Specific Issues

    Terminal Problem Workaround
    VSCode Shift+Enter sends wrong code Configure to send \n
    Windows Terminal ctrl+backspace, ctrl+c Use WSL or keybinds config
    Warp Alt+options don't work Terminal limitation
    Older emulators Doubled events Kitty protocol disabled

    Recent Fixes

    1. fix(prompt-input): handle Shift+Enter before IME check to prevent stuck state #8275 - Shift+Enter IME conflict (v1.1.11)
    2. docs: Expand keybinds documentation #7108 - Expanded keybinds documentation
    3. Kitty flag - Made configurable (commit 3750902)

    Recommendations

    For Users:

    • Modern terminals (Kitty, iTerm2): Use keybinds config to remap broken keys
    • VSCode: Configure terminal to send proper codes
    • Windows: Use WSL or follow https://opencode.ai/docs/keybinds/

    For Maintainers:

    Consider making `useKittyKeyboard** a user-configurable option:

    {
      "keybinds": {
        "useKittyKeyboard": true
      }
    }

    This would let users choose based on their terminal.

    Status

    Many issues have been fixed, but the fundamental terminal diversity problem remains. The Kitty protocol compromise is the best solution for now, but it means some bindings won't work on all terminals.

  9. aspiers commented on Jan 18, 2026

    @aspiers
    Contributor

    I submitted feature request #9234 and corresponding PR #6778 for adding readline- / Emacs-style keybindings for text transformations and pasting text which was previously cut. @rekram1-node I think this belongs on the above list, right?

  10. topmask commented on Jan 21, 2026

    @topmask

    ┌ Add credential
    │
    ◆ Select provider
    │ Search: _
    │ ● OpenCode Zen (recommended)
    │ ○ Anthropic
    │ ○ GitHub Copilot
    │ ○ OpenAI
    │ ○ Google
    │ ...
    │ ↑/↓ to select • Enter: confirm • Type: to search

    I cannot select an account to log in using the up and down arrow keys.
    I cannot focus on the upper level.

  11. keyle commented on Feb 23, 2026

    @keyle

    May I add a request to support vim bindings in selecting models? Many TUI support ctrl + j/k to move up and down lists, which would be a nice addition for hhkb users.

  12. unpinned this issue on Apr 2, 2026
  13. github-actions commented on Apr 25, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  14. bew commented on Apr 25, 2026

    @bew

    @rekram1-node I don't think you wanted that to happen.... 😬
    This thing is very annoying..

  15. dhruvkej9 commented on Apr 25, 2026

    @dhruvkej9

    Lol this github bot is closing pending issues, @rekram1-node this bot is creating issues rather than fixing them

  16. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on May 3, 2026
  17. nukeop commented on Jul 15, 2026

    @nukeop

    Opencode steals common browser shortcuts like Cmd+T, Cmd+. Also the web UI has updated itself somehow despite me deliberately staying on an older version... Did they force using their hosted version again somehow?

  18. camiicode commented on Jul 30, 2026

    @camiicode

    New Keybind Bug: App window crashes/instantly closes when using Windows Alt Codes for ISO characters

    While reviewing this tracking issue, I noticed this specific behavior hasn't been documented yet.

    When interacting with the main prompt text input field on Windows, attempting to type native ISO characters using standard Alt Codes (holding Left Alt + typing a numeric sequence on the Numpad) causes the entire application window to instantly terminate and close without any explicit UI error.

    This cleanly kills the client, completely corrupts the active session context, and leads to an unnecessary loss of token budget.

    Steps to Reproduce:

    1. Focus on the prompt input field inside an active session.
    2. Attempt to input any standard native sequence, such as:
      • Left Alt + 26 (intended character: →)
      • Left Alt + 126 (intended character: ~)
      • Left Alt + 60 (intended character: <)
      • Left Alt + 62 (intended character: >)
    3. The application window instantly closes upon key combination release.

    Expected Behavior:

    The text input container should properly capture, intercept, and escape native Windows WM_CHAR / Alt Code keystroke events, inserting the mapped symbol into the string instead of triggering application window lifecycle close commands.

    Environment:

    • OS: Windows 10 / 11
    • OpenCode Version: v1.2.26
  19. matejmosko commented on Sep 24, 2026

    @matejmosko

    Shift+enter in ghostty and gnome terminal not working on Ubuntu 26.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions