开发者

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

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

开发者_如何学C

Closed 4 years ago.

Improve this question

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?


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).


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.


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"':'"\\"'


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).


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜