baumi's blog

baumi's personal blog … Linux, OS X, Windows, Random things, …

macOS + Terminal on Linux: option + <space> encoding problem

When typing fast on Linux remote terminal shell sessions, I kept seeing errors because when typing | (alt + space) I accidentally still kept pressing option key while typing space. This created unwanted encodings that led to errors on Linux shell:

(press option, while holding option type 7 and while still holding option hit space)

cat -A <<< "| "
|M-BM- 

(press option, while holding option type 7, then after relasing option finally hit space)

cat -A <<< "| "
| 

Solution, on macOS modify the alt + space key binding (do NOT run as root):

mkdir ~/Library/KeyBindings ; vi ~/Library/KeyBindings/DefaultKeyBinding.dict

and add:

{
"~ " = ("insertText:", " ");
}

Comments are currently closed.