DEV Community

Shun Tedokon
Shun Tedokon

Posted on

đź‘» Ghostty's Option+Backspace Not Working? Fixed!

In Ghostty, you can configure key combinations to send arbitrary control characters. By using this feature, you can reproduce the familiar macOS behavior of deleting entire words with Option+Backspace in the terminal.

Ghostty Terminal Screencast

Ghostty versions prior to v1.2.0 seemed to support “Option+Backspace word deletion” without any additional configuration, but I suspect the behavior changed due to PR #7320 🤔

How to Configure

For example, add the following to your config file:

# ~/.config/ghostty/config
keybind = option+backspace=text:\x1b\x7f
Enter fullscreen mode Exit fullscreen mode

Now, pressing Option+Backspace will delete the previous word in shell line editing.

(\x1b\x7f corresponds to Meta-Backspace, which is equivalent to readline’s backward-kill-word.)


Difference from Ctrl-W (unix-word-rubout)

There is also a similar configuration:

# ~/.config/ghostty/config
keybind = option+backspace=text:\x17
Enter fullscreen mode Exit fullscreen mode

This sends Ctrl-W, triggering unix-word-rubout, which deletes text in units separated by whitespace.

On the other hand, \x1b\x7f also treats symbols and slashes as separators, making it convenient when editing paths or words containing hyphens.

Top comments (0)