It seems the control characters required for zsh
in Terminal are slightly different than the ones that worked in bash
.
To fix your Home/End keys:
- Open Terminal -> Preferences...
- Select your preferred profile
- On the Keyboard tab, add a new binding (or modify an existing one)
- Use the following settings to make Home work again:
- Key: Home (↖)
- Modifier: None
- Action: Send Text
- Text to send is
\033[1~
(For bash
, \033OH
was the value that worked)
- Use the following settings to fix the End key:
- Key: End (↗)
- Modifier: None
- Action: Send Text
- Text to send is
\033[4~
(For bash
, \033OF
was value that worked)
This fixes my Home/End keys in zsh
, and also works correctly when connected over SSH to terminals running bash
.
Note that if you have keybindings specified in your ~/.zshrc
or are running a third-party software to adjust your keybindings globally (eg: Karabiner), you might need to check or undo any settings in those places that may affect the Home/End keys if you're getting weird behaviour.