Wednesday, October 1, 2014

bash - Why do `bind` and `.inputrc` behave differently?

I'm trying to do the right thing and put my key bindings into ~/.inputrc.


However, it turns out that I have to change


bind '"\e\C-j":"\e[1~quiet \e[4~\n"'

into


"\e\C-j": "\eOHquiet \eOF\n"

Now \eOH (nav-block-pos1 bound to beginning-of-line) and \eOF (nav-block-end bound to end-of-line) are themselves bindings in my configuration which I possibly cannot always rely on.


So the main question is why does binding to num-block-pos1 (\e[1~) and num-block-end (\e[4~) work with bind but not in my ~/.inputrc?




Edit:


The whole thing is getting even more complicated, now that I realized that \e\C-j only works for Gnome Terminial (or probably xterm as well, who knows...).


For my TTY it has to be


"\e\C-m": "\e[1~_quiet \e[4~\n"

So is it that various VTs have different implementations of how to interpret keys or what?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...