I'm trying to create a shortcut in command mode. Basically, by typing :bl, I want it to execute gud-break. I tried the following

(evil-define-key 'insert c-mode-map (kbd ":bl") 'gud-break)

However, it complains that bl is not defined. Is there something wrong in my key binding?

  • You need to define an ex command.
    – Dan
    Mar 1 '18 at 15:23
  • You speak of "command mode" yet use insert state. This isn't going to work.
    – wasamasa
    Mar 1 '18 at 18:09
  • @Dan Thanks for the tip, I tried (eval-after-load 'evil-ex '(evil-ex-define-cmd "bl" 'gud-break)) This works.
    – Dennis
    Mar 1 '18 at 18:32
  • 2
    Time to answer your own question then!
    – wasamasa
    Mar 1 '18 at 18:40

The following creates the relevant evil ex command:

(eval-after-load 'evil-ex
  '(evil-ex-define-cmd "bl" 'gud-break))

Your Answer

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

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