opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Alt+Backspace to delete word does not work

Open jakst opened this issue 3 weeks ago • 4 comments

Description

Keybindings for deleting word from the cursor and back are set as ctrl+w,ctrl+backspace,alt+backspace in https://github.com/sst/opencode/blob/f3febd6e395458698fceca2f175f59e0cf68c1d6/packages/opencode/src/config/config.ts#L565-L568

However, Alt+Backspace does not work, which is slightly frustrating since it's the only one of them that works in all input fields on a Mac, and hence the one that's in muscle memory for most (I would assume, at least for me).

OpenCode version

1.0.206

Steps to reproduce

  1. Type a word into opencode textarea
  2. Ensure the cursor is somewhere in the middle of the word or at the end of the word
  3. Hit Alt+Backspace
  4. Observe only one character was deleted instead of the whole word up to the cursor

Screenshot and/or share link

No response

Operating System

MacOS 26.1

Terminal

Ghostty, MacOS Terminal

jakst avatar Dec 28 '25 20:12 jakst

For keybind-related issues, please also check our pinned keybinds documentation: #4997

This issue might be a duplicate of existing issues. Please check:

  • #4965: option delete doesn't delete word by word
  • #4997: Keybinds (master issue tracking multiple keybind problems including word deletion issues)

The #4997 issue documents that word deletion keybinds (option+delete, alt+d, ctrl+backspace, alt+backspace) are broken and not working reliably across different terminals and operating systems.

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Dec 28 '25 20:12 github-actions[bot]

If https://github.com/sst/opencode/issues/4965 is reopened, I can close this issue.

Workaround from that issue that works for me at the moment is this Ghostty config

keybind = alt+backspace=text:\x1b\x7f

jakst avatar Dec 28 '25 20:12 jakst

I have exact same setup, and without any special modifiers this works, I cannot reproduce your bug.

This is my entire ghostty config:

keybind = cmd+b=next_tab

rekram1-node avatar Dec 28 '25 22:12 rekram1-node