I sometimes find myself using a command repeatedly (using M-x
) but I do not want to bind it to a key in my init-file, because I only use it in certain sessions. How would I bind a command to a key interactively?
Let's say I want to bind bury-buffer
to C-c q
. I could use M-: (bind-key "C-c q" 'bury-buffer)
(I'm using use-package
), but that's a lot of typing. What I want is to complete from a list of all interactive commands, and then input a kbd
-string to which the chosen command should be bound.
M-p
andM-n
to move through the history of commands you invoked withM-x
.