Mac OS X Terminal [Use option as meta key] overrides backslash in spanish keyboard

bashkeyboardmacterminal

I already posted this question in stackoverflow:

https://stackoverflow.com/questions/4811282/mac-os-x-terminal-use-option-as-meta-key-overrides-backslash-in-spanish-keyboar

but I was informed there that this is the right place to ask it.

I check "Use option as meta key" checkbox in Mac OS X Terminal, because I like to use emacs way of moving between words: M-f & M-b.

But if I do that, I can't get the backslash (Option + º; i.e.: Option + key-at-the-left-of-1-in-spanish-keyboard). If I uncheck it, then I can input the backslash, but I don't have M-f & M-b.

Is there a way to get both? This is driving me nuts!

Best Answer

And, as I already answered you on stackoverflow, the solution is to put the following line into your ~/.bash_profile, which remaps the unicode character "∫" (Unicode: E288AB, which is what is sent to your terminal right now in your desired configuration when you press Option + °) to the backslash character:

bind '"\033\xE2\x88\xAB"':'"\\"'