10

evil-mode introduces vim-style colon commands (such as :wq to save and close).

I have a few commands (such as kill-buffer, org-babel-tangle) that I'd like to be able to run through this instead of the keybindings they currently have.

How can I add colon-commands like :k for kill-buffer and :tangle for org-babel-tangle?

J David Smith
  • 2,635
  • 1
  • 16
  • 27

1 Answers1

11

The official way of doing this is demonstrated in evil-maps.el.

Therefore, creating a new ex command is very simple:

(evil-ex-define-cmd "b[utterfly]" 'butterfly)

You'll want to either use this after enabling Evil or alternatively after loading the respective file:

(eval-after-load 'evil-ex
  '(evil-ex-define-cmd "b[utterfly]" 'butterfly))

Doing this will modify evil-ex-commands appropriately.

wasamasa
  • 21,803
  • 1
  • 65
  • 97