Is there a way to map CTRL+A and CTRL+E to work system-wide as move to beginning of line, and move to end of line correspondingly?
I.e. I would like these shortcuts to seamlessly work in any app, not only in the terminal (i.e. as in OSX).
My main system is Ubuntu with the Unity desktop, but it would be good to have a universal solution which would be desktop-agnostic, or at least be supported in Gnome, XFCE and LXDE.
Best Answer
xmodmap
might seem to provide an answer, but it does not, because the keycodes it manipulates are existing keys on the keyboard, not modified keys. A controlA is a modified key.xmodmap
can only reassign existing keycodes or (their names) keysyms, as listed in its manual page:To see the keycodes that
xmodmap
knows about, runwhich shows something like this (shortened for clarity):
xev
shows what actually happens:The control modifier is the
0x4
in the state; theXLookupString
(one of several related functions for combining key events) transforms the keysym for "a" into^A
(control/A).Because there is no keysym for any of the control keys, reassigning keycodes using
xmodmap
will not be possible for OP's problem.To solve OP's problem, one would have to have a way to tell the operating system to (essentially) refuse to deliver separate events for control and A — but Linux and X do not work that way. Limiting the scope to a particular application (xterm) or set of applications (Gtk-based programs), one might address those separately. But a solution which applies system-wide does not seem doable.