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

6

10

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?

Elijaheliminate answered 26/1, 2011 at 23:21 Comment(4)
This probably belongs on SuperUser.com or better yet, Apple.StackExchange.comRodolphe
+1 for letting me understand that there was a "Use option as meta key" box.Shriner
I have the same problem with my usual french (Azerty) layout. Under other OSes (Win and Linux), I can map (left)Alt as META, while (right)AltGr allows me to input alternative grahics. I can thus navigate efficiently and input all the characters available on my layout. I am still to find a way to achieve this under OS X Terminal, not finding any accepted answer here makes it look difficult.Whitebait
Cross-site duplicate apple.stackexchange.com/questions/7084/…Brigade
C
2

The escape key works as a meta key by default; no need to use option as the meta key (other than its more convenient location).

Cloying answered 4/7, 2012 at 12:28 Comment(3)
The Option key is also a lot easier to type fluidly, because it's a modifier key. To use ESC you have to press and release the key, then type the key you want to modify.Wordage
The first part of the answer would make for an interesting comment (not an answer obviously), the part about it being "not needed" is a respectable opinion, but will not help anyone who needs this functionality (eg. Linux background).Whitebait
Thank you! Despite the whiney, this is the only answer with an explanation on how to use the META key without tweaking the macos keyboard!Elstan
R
1

Not a great solution, but XTerm (running in X11 on OS X) can use CMD as the Meta key.

You might also have some good results from KeyRemap4MacBook.

Just as a side benefit, XTerm should also give you proper terminal mouse interaction, e.g. in Emacs or ncurses based apps.

Rodolphe answered 27/1, 2011 at 0:50 Comment(0)
C
1

You will most likely run into a lot more problems with that setup, because Mac OS uses "Alt" as a modifier in a lot of shortcuts. But anyway, including the following line in your ~/.bash_profile will send a backslash if you enter the unicode character "∫" (which is E288AB):

bind '"\033\xE2\x88\xAB"':'"\\"'
Cameo answered 27/1, 2011 at 12:15 Comment(1)
But how would one enter that when Option is Meta?Wordage
W
1

You could customize the keyboard map to use a different key for entering backslash. Look in

Preferences > Settings > [profile] > Keyboard

For example, you could map Control-F1 to backslash.

Note that the default keyboard map maps Option-Left/Right Arrow to M-b/f, so you could use those instead of using Option for Meta (you’d have to get used to using the arrow keys instead of b and f, but I’ve never been able to get used to using b and f and prefer the arrow keys).

Wordage answered 4/7, 2012 at 3:58 Comment(0)
J
0

I had the same issue. This is how I solved it.

I replaced the built in terminal with iTerm2, which also gave me a few other nice features. To get a sane Meta-key i did the following:

For the profile I wanted to use I checked "Alt sends +Esc", which gave me back a sane Meta-key that works in Emacs, Bash and others. However, I did lose the backslash key. So, to get it back and added a binding in the profile that does "Send text: \" and then I bound it to my backspace key combo (Shift-Alt-7, I'm Norwegian).

Now I have M-f, M-b in Emacs, M-. in Bash and I'm able to send backslashes. I also have a "Visor shell session" that I can have slide down by pressing another key combination.

Jairia answered 17/3, 2014 at 11:30 Comment(1)
Wow. Thank you for making me aware of M-. in bash (also works in zsh)!Statehood
P
0

This is years late, but for people coming across this page whilst searching for a solution, as I did, I have decided to build one myself.

It is a simple status bar app that runs in the background and rewrites all left-Alt + $KEY key events to two key events in rapid succession, Esc, then $KEY; however, it only does this if Terminal.app is the focused application.

You can find it here at https://github.com/habibalamin/Metalt.

Panslavism answered 5/4, 2018 at 12:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.