Option + Enter Should Just Work
The tiniest fix that drove me the most insane
Hey folks!
This is a short one. But I need to get it off my chest.
Press Option + Enter in your terminal. Go ahead, try it. If you are using most terminals, you get a normal newline. Your shell runs the command or drops to the next line. Life is good.
What Is Happening
The xterm modifyOtherKeys protocol is a way for terminals to tell applications “Hey, the user pressed Option along with this key.” It encodes the modifier and the keycode into an escape sequence:
\x1b[27;2;13~That is: Escape, CSI, key event 27, modifier 2 (Shift), keycode 13 (Enter), terminator. A perfectly valid terminal protocol sequence.
The problem is that your shell does not care.
Zsh does not parse modifyOtherKeys sequences for Enter. Bash does not either. Fish does not. Nushell does not. They see \x1b[27;2;13~ and go “that is not a keybinding I recognize” and print the tail end as literal text.
Sadness. Every. Single. Time.
Now, we don’t have a sadness and that’s a great thing. That is it. That is the entire blog post. Option + Enter sends Enter. As God intended.
— 8



