When I press alt + left arrow
, Urxvt prints [D
, or alt + up arrow
prints [A
.
Is there a way to disable this behavior so that urxvt just does nothing?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityWhen I press alt + left arrow
, Urxvt prints [D
, or alt + up arrow
prints [A
.
Is there a way to disable this behavior so that urxvt just does nothing?
What's happening is that urxvt is translating the key chord Alt+Left into the escape sequence \e\e[D
(I use \e
to represent an escape character). This is a reasonable choice; another common one is \eO1D
.
You should configure the applications running in the terminal to understand that \e\e[D
means Alt+Left. For bash and other applications using the readline library, add a line like this in your ~/.inputrc
(in this example, I make the key combination move backward word by word):
"\e\e[D": backward-word
Alternatively, configure rxvt to send \eO1D
(and if necessary teach your applications to understand this as Alt+Left). This might be more convenient than \e\e[D
because it doesn't have two control characters in a row. You can configure rxvt's key bindings through X resources. Put the following line in your ~/.Xresources
(many environments load it when you log in; to load the file manually, run xrdb -merge ~/.Xresources
):
URxvt.keysym.Meta-Left: \033O1D
These can be configured in ~/.Xresources
file. Urxvt has Urxvt*keysym
options to remap keycodes (see Urxvt man page) For example:
Urxvt*keysym.A-Left: command:\000
Urxvt*keysym.A-Right: command:\000
This will remap alt+Left and alt+Right to nothing.
You need to remember to do xrdb ~/.Xresources
in order to this work, and spawn a new Urxvt terminal.