How to map Ctrl-p to up arrow using xmodmap?

I did read the grammar section of xmodmap but still couldn't figure out how I could do it.


This isn't easily possible.

As the xmodmap man page states:

The first keysym is used when no modifier key is pressed in conjunction with
this key, the second with Shift, the third when the Mode_switch key is used
with this key and the fourth when both the Mode_switch and Shift keys are used.

By default, AltGr is the Mode_switch key.

It is possible to map a different or additional (to AltGr) as the Mode_switch key, e.g. the right Ctrl key:

xmodmap -e "keycode 105 = Mode_switch Mode_switch"

The problem however is that the key then won't work as normal Ctrl key anymore.

Btw: There is a question, which asks for precisely, how to use the Ctrl key as a modifier key: How to use Control as modifier with xmodmap?


Try:

xmodmap -e "keycode 33 = p P Up"

and let me know if it's the result you're looking for.