opencode icon indicating copy to clipboard operation
opencode copied to clipboard

shift-modified keybindings ignored inside tmux

Open camescasse opened this issue 1 year ago • 11 comments

Any keybinding that relies on shift+ is ignored when opencode is running inside a tmux pane. The same bindings work perfectly when opencode is launched outside of tmux.

OS | Arch Linux 6.15.3 tmux | 3.5a Ghostty | 1.1.3 OpenCode | 0.1.121

This is true for both default and custom keybindings.

camescasse avatar Jun 23 '25 17:06 camescasse

Shift+enter for a new line didnt work for me. Had the same doubt if something was clashing with either ghostty or tmux

mohak34 avatar Jun 23 '25 19:06 mohak34

Same for me. In other coding agents Alt + Enter is supported. That could be an alternative.

Axenide avatar Jul 01 '25 01:07 Axenide

Indeed, after configuring it to alt+enter it works inside tmux. :)

Axenide avatar Jul 01 '25 01:07 Axenide

there's more to the story, i haven't tracked this down yet, but, fwiw, shift+enter works in tmux for me

adamdotdevin avatar Jul 01 '25 01:07 adamdotdevin

EDIT: see my other comment


~I was able to get it to work by adding this to my config and reloading tmux~:

set -s extended-keys on

(I use Ghostty as my emulator)

More docs are available here: https://github.com/tmux/tmux/wiki/Modifier-Keys

dkarter avatar Jul 25 '25 06:07 dkarter

I take that back - while it did fix the issue for OpenCode - this introduced another issue that prevents pasting text into neovim without all kinds of junk special characters being added :(

dkarter avatar Jul 25 '25 19:07 dkarter

Disabling this setting resolved it 🤔 maybe it's no longer needed (truecolor is working still!)

Image Image

dkarter avatar Jul 25 '25 19:07 dkarter

Having the same issues

macOS: Version 15.7.2 tmux: stable 3.5a Ghostty: Ghostty 1.2.3 opencode: 1.0.85

Attempted a similar fix to @dkarter by commenting out this part of my tmux config:

# set -g default-terminal "xterm-ghostty"

But no luck. Opencode with shift+enter for a newline works well outside of Tmux, just not inside of it.

mahume avatar Nov 21 '25 19:11 mahume

EDIT: see my other comment


~I was able to get it to work by adding this to my config and reloading tmux~:

set -s extended-keys on

(I use Ghostty as my emulator)

More docs are available here: https://github.com/tmux/tmux/wiki/Modifier-Keys

@mahume I think you need to add this to the tmux config file and comment out the true color option. I have both of these in my config but have not faced any problem with pasting in neovim. Also the shift enter works for opencode inside tmux

mohak34 avatar Nov 21 '25 21:11 mohak34

EDIT: see my other comment

~I was able to get it to work by adding this to my config and reloading tmux~: set -s extended-keys on

(I use Ghostty as my emulator) More docs are available here: https://github.com/tmux/tmux/wiki/Modifier-Keys

@mahume I think you need to add this to the tmux config file and comment out the true color option. I have both of these in my config but have not faced any problem with pasting in neovim. Also the shift enter works for opencode inside tmux

This approach seems to result in the same issues with pasting into Neovim as described above with extra characters. I'll prob just stick with not using carriage returns in opencode. Let the LLM handle parsing that. Better than me having to parse my pasted code for hidden characters

mahume avatar Nov 24 '25 18:11 mahume

EDIT: see my other comment ~I was able to get it to work by adding this to my config and reloading tmux~: set -s extended-keys on (I use Ghostty as my emulator) More docs are available here: https://github.com/tmux/tmux/wiki/Modifier-Keys

@mahume I think you need to add this to the tmux config file and comment out the true color option. I have both of these in my config but have not faced any problem with pasting in neovim. Also the shift enter works for opencode inside tmux

This approach seems to result in the same issues with pasting into Neovim as described above with extra characters. I'll prob just stick with not using carriage returns in opencode. Let the LLM handle parsing that. Better than me having to parse my pasted code for hidden characters

Is this not fixed when you comment out this line for true color support and have extended keys on in your tmux config? I do not have this issue but seems it is still caused due to some reason.

set -s extended-keys on # set -g default-terminal "xterm-ghostty"

mohak34 avatar Nov 24 '25 19:11 mohak34