Your Ghostty Keybindings Are Broken (Here's the 60-Second Fix)
Source: Dev.to
Introduction
You know that thing where you press ⌘← to jump to the start of a line and Ghostty just… prints ^A?
Let’s fix that.
macOS has beautiful text navigation shortcuts:
- ⌥← / ⌥→ – Jump by word
- ⌘← / ⌘→ – Jump to start/end of line
- ⌘⌫ – Delete everything before the cursor
These work everywhere—Notes, VS Code, your browser—except Ghostty. Instead you get garbage like this:
python -m venv .venv && source .venv/activate^E^A^E^A
Not great.
Fix the keybindings
-
Create or edit your Ghostty config
mkdir -p ~/.config/ghostty nano ~/.config/ghostty/config -
Add this line (the file uses a simple
key = valueformat):macos-option-as-alt = true -
Save and restart Ghostty (it doesn’t hot‑reload config changes).
-
Make sure your shell interprets the escape codes
bindkey -eIf it works, make it permanent:
echo "bindkey -e" >> ~/.zshrc
That’s it. You’re done.
Those ^A and ^E characters are actually the correct escape codes for “beginning of line” and “end of line”—your shell just wasn’t listening.
Keybinding reference
| Shortcut | What it sends | Action |
|---|---|---|
| ⌘← | Ctrl+A | Beginning of line |
| ⌘→ | Ctrl+E | End of line |
| ⌥← | \x1bb | Back one word |
| ⌥→ | \x1bf | Forward one word |
The bindkey -e command puts zsh into Emacs mode, which is what makes it understand these codes. Some shell configurations (especially if you’re using oh‑my‑zsh or other frameworks) might override this, so adding it explicitly is a good idea.
If you switched from Warp to Ghostty, this is probably the first thing that felt broken. Warp handles these shortcuts natively because it’s built differently. Ghostty is a traditional terminal emulator, so it needs a little help.
Now you’ve got the best of both worlds—Ghostty’s speed and simplicity with the keybindings your fingers expect.
Tested on Ghostty + zsh on macOS.