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?

1 Answer 1


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.

  • Excellent! I had tried finding that but didn't succeed (obviously) Mar 27, 2015 at 18:37
  • I got that reference!
    – PythonNut
    Aug 4, 2015 at 15:25

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.