Skip to content

shift+enter on tmux not working #167

Closed

Description

@albertilagan

not really sure if this is a tmux or opencode issue, but when I'm on tmux hitting shift+enter sends the request instead of creating a new line.

I totally nuke my tmux config just to make sure it's related to any of my packages on tmux, didn't work

unbind C-b

set -g prefix C-a
bind C-a send-prefix

bind r source-file ~/.config/tmux/tmux.conf

set-option -g default-terminal "tmux-256color"
set-window-option -g xterm-keys on
set-option -ga terminal-overrides ",xterm-ghostty:XT"

(also have passthrough on before)

My current workaround is this

# tmux config
bind-key -n S-Enter if-shell '[ "#{pane_current_command}" = "opencode" ] || [ "#{window_name}" = "opencode" ]' \
    "send-keys M-Enter" \
    "send-keys S-Enter"
# opencode config
{
  "keybinds": {
    "input_submit": "enter",
    "input_newline": "alt+enter,ctrl+j",

Activity

  1. adamdotdevin commented on Jun 18, 2025

    @adamdotdevin
    Member

    i just overhauled keybinds completely, check the readme; you can now configure newline to a different key, lmk if that's a solution for you!

  2. GitMurf commented on Jun 18, 2025

    @GitMurf
    Contributor

    fyi Windows Terminal + WSL2 + zsh shell + Arch Linux I also had an issue where the default shift + enter does not work (it submits the message to the LLM). But as @adamdottv mentioned, I reset the keymap to be ctrl + enter or ctrl + j (see below) and it works great! For others who may run into the same issue.

    [keybinds]
    leader = "ctrl+x"
    input_newline = "ctrl+j,ctrl+enter"

    NOTE: you see I added the leader keybind there because it appears as if you set any keybind, the leader keybind no longer is set by default so you have to explicitly add it. cc @adamdottv

  3. net commented on Jun 19, 2025

    @net

    FWIW shift+enter works for me in tmux and Ghostty.

  4. aminroosta commented on Aug 20, 2025

    @aminroosta

    I had the same issue with tmux and ghostty, the following workaround solved it for me.

    # ~/.config/ghostty/config:  map shift+enter to ctrl+e
    keybind = shift+enter=text:\x05

    and

    # ~.config/opencode/opencode.json: map ctrl+e to input_submit
    {
      "keybinds": {
        "input_submit": "ctrl+e",
        "input_newline": "shift"
  5. princejoogie commented on Jan 4, 2026

    @princejoogie
    Contributor

    for kitty users, i added this to my kitty.conf

    + map shift+enter send_text all \x1b[13;2u
  6. added a commit that references this issue on Jan 9, 2026
    75d1ead
  7. oricho123 commented on Feb 18, 2026

    @oricho123

    This did it for me (for claude code usage)

    # Let tmux recognize Shift+Enter from iTerm2, then forward as CSI u bytes
    set -s extended-keys on
    set -as terminal-features 'xterm*:extkeys'
    bind -n S-Enter send-keys -H 1b 5b 31 33 3b 32 75
    
  8. larrybotha commented on Feb 21, 2026

    @larrybotha

    @oricho123 excellent, thanks

    I only needed the send-key config:

    larrybotha/dotfiles@7a2a76b

    i.e.

    bind -n S-Enter send-keys -H 1b 5b 31 33 3b 32 75

    my terminal-features are different to yours, and I don't seem to need extended-keys to have shift+enter create new lines, so I'm not sure what the minimal required configs are, but the key seems to be sending hex-encoded representation of the CSI key

    environment:

    • MacOS
    • tmux
    • ghostty
    • neovim

    newlines with shift+enter now working consistently regardless where opencode is opened

  9. scottlittle commented on May 13, 2026

    @scottlittle

    for kitty users, i added this to my kitty.conf

    • map shift+enter send_text all \x1b[13;2u

    And likewise for wezterm users, I added this to my wezterm.lua:

    config.keys = {
      {
        key = 'Enter',
        mods = 'SHIFT',
        action = wezterm.action.SendString('\x1b[13;2u'),
      },
    }
  10. DePingus commented on Jun 13, 2026

    @DePingus

    for kitty users, i added this to my kitty.conf

    • map shift+enter send_text all \x1b[13;2u

    Just FYI for future searchers...
    This works, but you also have to enable extended-keys in your ~/.tmux.conf

    set -g extended-keys on
    set -g extended-keys-format csi-u
    
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