This is regarding this issue with docker: https://github.com/docker/docker/issues/3519 and https://stackoverflow.com/questions/20828657/docker-change-ctrlp-to-something-else

As I understand this, the docker run -it command opens an interactive terminal and this terminal has special meaning for Ctrl-P + Ctrl-Q combination (detaches from the container). This messes up with the bash and emacs shortcuts when you are inside the container. I've to press Ctrl-P twice for the Ctrl-P to reach bash or emacs.

Is there any way to workaround this (other than re-compiling docker itself) by some kind of terminal/bash keybinding magic?

What I'm specifically trying to see is if there is some way where by remapping keys, pressing Ctrl-J (anything other than Ctrl-P for that matter) will be read by the docker terminal as Ctrl-P. More importantly, I want to remap Ctrl-P itself to something else, say Ctrl-L. So whenever I press Ctrl-P, the docker container would receive Ctrl-L. And then I can program bash/emacs inside the docker container to map Ctrl-L to the command corresponding to Ctrl-P (move to previous command/line).

In short, I press Ctrl-P, the docker session receives it as Ctrl-L and passes it along to emacs, emacs maps Ctrl-L to the command corresponding to Ctrl-P.

Is this even a reasonable ask?

I would be glad if there is some other relatively easy workaround for the original problem.

I'm using OS X's Terminal app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.