4

I appear to be using GNU bash, version 4.4.12, though it's possible my organization has modified it from HEAD. I'm trying to bind ctrl+x:

$ bind -x '"\C-t": "echo testing"'
<I press ctrl+t>
testing
$ bind -x '"\C-x": "echo testing"'
<I press ctrl+x>
-bash: bash_execute_unix_command: cannot find keymap for command

EDIT: Just realized I can bind \C-x\C-x (or any other combo that starts with \C-x. So it seems that ctrl+x is recognized but somehow required to be part of a longer sequence. I know there are lots of default sequences starting with ctrl+x, and I even tried unbinding all of them to see if it would help (it did not).

5
  • Does it happen under bash --noprofile (or also --norc) ? Commented Oct 16, 2017 at 22:04
  • Read man bash and search for "Readline Key Bindings". Commented Oct 16, 2017 at 22:33
  • @thrig Yes, it still happens in both those cases. But, I found one new interesting detail and edited it into the OP. Commented Oct 16, 2017 at 22:51
  • 3
    Looks like there is a keymap emacs-ctlx and C-x is permanently bound to that, so it can be a prefix char for 2 character bindings. You could move to vi mode, but that will change lots of other bindings. Commented Oct 17, 2017 at 16:06
  • @meuh Interestingly, if I specify a keymap in my bind command, any keymap, then the error message goes away, and instead the screen clears after pressing ctrl+x. Ironically, clearing the screen is the action I originally wanted a binding for. So in a way that solves my issue. But not really because (a) the mystery still remains and (b) there is a small delay with this binding, and I'd rather it be instantaneous which I can do if I can truly change the binding action (I suspect it's calling reset now, which is slow. Commented Oct 17, 2017 at 21:17

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.