2

I have two shortcuts defined like this

;; eval in shell
(global-set-key (kbd "C-c x s") 'eir-eval-in-shell)

;; eval in ruby
(global-set-key (kbd "C-c x r") 'eir-eval-in-ruby)

which-key helps me when I forgot my keyboard shortcuts.

The problem is, When I press C-c and wait 1 second I don't get any useful info about the above 2 combos.

What I get is

& → +prefix     e → er/expand-region h → experiment-001 m → experiment-002 → +projectile-command-map
b → bury-buffer f → ffap             i → experiment-003    o → experiment-005 x → +prefix
C-c-  [C-h paging/help]

But

x → +prefix

doesn't help. Any ideas what to do here?

1 Answer 1

2
  • Use define-prefix-command to define a named prefix
  • Bind C-c x to that prefix command
  • Bind s and r in the prefix command keymap

When you type C-c, which-key will then show you your chosen prefix name instead of just "prefix", which gives you better context for which commands you can expect to be bound underneath it.

Obviously you can type x (with or without doing the above) to see the bindings themselves.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.