1

How can I remap these keys so they work as Meta?

I'm trying to use Meta-b and Meta-f to go backwards and forwards using emacs mode in my shells. I'm noticing a number of non ASCII characters when I press these Option-b or Option-f.

I noticed in Mac's Terminal.app the option "Use Option as Meta key" checked resolves this issue. It doesn't resolve the issue in my "xterm" session though. I think I can remap Option globally in Preferences, however this would impact all Mac applications.

I see some posts referencing setxkbmap and xmodmap. I tried xmodmap per [this][1] post and keys are still not working.

$ cat ~/.xmodmap

clear Mod1
! keycodes 66 and 69 are the option/alt keys; assign them as Meta keys
keycode 66=Meta_L
keycode 69=Meta_R
! now tell X11 that the Meta keys act as the Mod1 (meta) modier key; that is, when they are pressed with KEY, it is the same as hitting M-KEY
add Mod1 = Meta_L Meta_R

$ xmodmap ~/.xmodmap

 X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  118 (X_SetModifierMapping)
  Value in failed request:  0x17
  Serial number of failed request:  14
  Current serial number in output stream:  14

The keys output when I press OPTION-f after xmodmap:

$ æ

Pressing left option, shows mapping but it doesn't impact the shell behavior:

$ xev

KeyPress event, serial 34, synthetic NO, window 0xa00001,
    root 0x141, subw 0x0, time 613883038, (791,832), root:(791,855),
    state 0x0, keycode 66 (keysym 0xffe7, Meta_L), same_screen YES,
    XKeysymToKeycode returns keycode: 19
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.